CSS CSS Selectors Selectors - Beyond the Basics Child, Adjacent, and General Sibling Combinators

Shung Chen
Shung Chen
6,521 Points

What is the diff between these selectors: "ol li" and "ol~li"

as mentioned. thought both are targeting the second element

many thanks

1 Answer

Mohammad Azawi
PLUS
Mohammad Azawi
Courses Plus Student 5,617 Points

ol li :

It will select the (li) element inside (ol) element

ol~li:

It will select (li) element that are siblings of and subsequent to any (ol) element

ps: the second selector is wrong because of their is no (li) element by itself.