DEV Community

Cover image for It makes a difference whether you include '>' in your css selector
Richard
Richard

Posted on

It makes a difference whether you include '>' in your css selector

Regarding css selectors, I learned that there is a difference between ".parent-element > .child-element" and ".parent-element .child-element.". Notice how one version includes a carrot. If you use the carrot, it means you are targeting DIRECT children of the parent element. If you omit the carrot, then you are targeting ANY children under the parent element, regardless of whether it is a direct child or not.

Top comments (1)

Collapse
 
richardkentng profile image
Richard

Here's a great post that talks about many types of selectors!: dev.to/st1llwater/selecting-the-ri...