Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS CSS Selectors Going Further with Attribute Selectors and Pseudo-Classes :only-child and :empty

Aakash Srivastav
seal-mask
.a{fill-rule:evenodd;}techdegree
Aakash Srivastav
Full Stack JavaScript Techdegree Student 11,638 Points

:empty

In the video Guil is saying , if we need to target elements, that have no child elements, or content what so ever, we can use the empty structural pseudo class, but we can see , only list item 7 has been effected that has no content. My question is why those "list" elements doesn't get affected that doesn't have "span" element as such list items do not have any child too.

1 Answer

Chris Shaw
Chris Shaw
26,676 Points

Hi Aakash Srivastav,

The reason the li elements with just text don't get selected is because they count as content. Text in HTML can be referred to as text nodes also.

Hope this helps.