0

Hi! I read that IE 8 accepts child selectors. But it does not seem to work for my IE8 (Spanish version if this even matters).

#div > p{background-color: blue;}
========================
<div id="div">
<p>Shoud work here!</p>
        <div>
                <p>and not here</p>
        </div>
</div>

It works for firefox and not for internet explorer. What could be happening?

3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by MidiMagic
0

Hi! I read that IE 8 accepts child selectors. But it does not seem to work for my IE8 (Spanish version if this even matters).

#div > p{background-color: blue;}
========================
<div id="div">
<p>Shoud work here!</p>
        <div>
                <p>and not here</p>
        </div>
</div>

It works for firefox and not for internet explorer. What could be happening?

What DTD are you using? Might require STRICT mode.
But if you are working in a strict document than it will mean it doesn't support direct child selector syntax.

But this is a highly effective workaround - try this.

<style type="text/css">
            #div p{background-color: blue;}
            #div div p{background-color: transparent;}
	</style>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.