It has me a bit confused, I was in freecodecamp practicing a bit of what css is, and at the beginning I used ul li, for example, but later on other times it told me to use ul > li. Is there any difference between these?
It has me a bit confused, I was in freecodecamp practicing a bit of what css is, and at the beginning I used ul li, for example, but later on other times it told me to use ul > li. Is there any difference between these?
Well yes, in your example it performs the same process, affecting all the labels
You see, the space (ul li) will affect all li elements within ul while the sign (ul > li) will affect all li elements that are DIRECT children of ul
That is, if you add a div with li elements inside, they would only be affected by the first form (ul li), not by the second since, as I mentioned, it will only affect the direct children and the li inside the div would not enter that category
ul li
will affect thoseli
in ordered lists (ol li
) when they are inside an unordered list (ul li ol li
).ul > li
will affectli
only if they are in an unordered list