Explanation needed for Test Your Skills: Selectors 4

Hello everyone,

I was doing the exercise an wrote two selectors, however I can’t explain why their behavior is different, namely why

ul.list >li is different from ul >li

There is only one “ul” in the html so why adding the class makes such a difference? I just can’t wrap my head around it.

Hello @patpas43

this ul.list >li look for unordered list that has class attribute called list

so if it not found it would not apply it

and since the html does not show any ul with class list then that selector and it’s rule will be ignored

hope that help and have a nice day :slight_smile: