To take the immediate child element, and not any one child.
For example:
.avo
{
background-color:red;
height:50px;
}
.avo > .pai > .filho {
color:red;
background-color:yellow;
height:20px;
}
.avo .filho{
background-color:green;
color:white;
}
<div class="avo">
<div class="pai">
<div class="filho">Eu sou o filho</div>
</div>
<div class="filho">Eu sou o filho</div>
</div>
This is very useful in cases of menus where you do not want a definition, even done directly in tags, not applied to all elements.
Example:
nav.menu > ul{}
nav.menu > ul > li {}
If I have to put another ul
to create a submenu within the class li .menu
, will not interfere, since css is set to the immediate child of nav.menu
(nav.menu > ul
) and not for any ul
inside nav.menu
(nav.menu ul
).
So summing up the difference between the two forms could be put like this:
nav.menu > ul
= Immediate son
nav.menu ul
= Any son
http://stackoverflow.com/questions/3225891/what-does-the-greater-than-sign-css-selector-mean
– Daniel Omine
Very good question +1. I think it’s best to have this question in English
– Wallace Maxters