Parent> CSS child selector

I often use this parent> CSS selector. My design looks good in Mozilla and Opera.

But in IE it sucks. I know that > not recognized in IE, but what is an alternative to this in IE?

+3
source share
2 answers

There is no alternative for a direct child selector in IE6 (it should work in IE7, though).

Instead, you need to use the child selector (space) and create your own classes to compensate.

+6
source

One option is to use a universal selector to create a more specific rule that will take effect if the nodes are not direct children:

 div p {color: red;} // Takes effect if there a <p> child at some level div * p {color: black;} // .. but this'll be true if it not a direct child 

However, you need to keep track of specific conflicts. div * p will be more specific than another rule that works, for example, with paragraphs in general.

+11
source

Source: https://habr.com/ru/post/1432166/


All Articles