iKevinShah

iKevinShah

Whats that ">" between a parent and child selector in CSS


Posted by iKevinShah in Webmaster16 December, 2016

Lets clear that the ">" in between a parent and child class / ID.

The difference between:


.container>div{
 property:value;
}
and

.container div{
 property:value;
}
The difference is:

The css in case of ( .container> div ) will only be applied to divs that are immediate child of .container and the grand children will not receive this css. If you replaced the ">" with a space , you would find that all divs under .container will receive the css irrespective of the number and level of grand children down that hierarchy.


  December 16, 2016, 1:24 pm