Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Is it possible to affect only an ID that’s within a specific ID?

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #34261
    dshelby
    Member

    While I understand IDs are supposed to be unique and this is not the best way to do this, I am trying to customize a third party platform and I really only have limited access to the code. Mostly I can just tweak the CSS.

    So, I am trying to hide the navbar and build my own that is part of the header, which I’ve done by changing the display options on the navbar ID in the CSS. The issue is that it has also hidden an important bit of navigation for the admin pages. There is no class differentiation between the admin and public pages. The only difference seems to be that on the admin page there is a separate ID in which the navbar ID resides.

    Is it possible to essentially override the “display: none” on the admin pages by chosing navbar only when it is inside of the admin_text_container? If so, how do I do that?

    Help?

    Thanks,
    Dallas

    #86670
    TheDoc
    Member

    Hmmmm. Tough to say without looking at the code. Would you mind posting the sidebar HTML?

    #86678
    dshelby
    Member

    Regular Page:


















    Admin Page:







    #86679
    JoeW
    Member

    To select an ID within an ID, use a child selector:


    #outercontainer > #innercontainer {property:value;}

    http://www.w3.org/TR/CSS2/selector.html#child-selectors

    And then if it’s applying properties to the same values on other pages (it shouldn’t, because you mentioned that admin_text_container is only on that page), you can always apply more specific rules to revert ONLY the elements on THAT page back to their original style.

    Hope this helps!

    #86683
    TheDoc
    Member

    I assume you have this:

    #navbar { display: none; }

    To see the admin navbar, do this:

    #container_admin_1 #navbar { display: block; }
    #86691
    dshelby
    Member

    Yeah. That’s it exactly. Thanks so much.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘CSS’ is closed to new topics and replies.