PDA

View Full Version : A question about "display: none".


moss2076
11-23-2007, 07:32 PM
I have a div called "outerdiv" which I do not want to be displayed if a certain body ID is applied - eg body id="showinnerdivonly", but I want it to be displayed if it is not applied.

What I want to know is - does the "display: none" rule stop not only the outerdiv being displayed but innerdiv aswell?

How can I make the inner div display but not outerdiv?

<Div id="outerdiv">
<Div id="innerdiv">
content here
</div>
</div>

I know I can use <!-- --> but I want to know how I get it to work using a body id called say "body id="showinnerdivonly" - if all that makes sense!

Apostropartheid
11-23-2007, 07:52 PM
If outerdiv is set to display: none; it won't display. Try this:
body #outerdiv {
display: block;
}
#myotherbodyid #outerdiv {
display: none;
}
#myotherbodyid #innerdiv {
display: block;
}