Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2
Descendant selectors are used for navigation bars and so on so we use these elements in html like ul and then add li so that's telling us that the li is an descendant(ancestor) of that <ul> This descendant selector will match all four li elements in the example HTML, because each of those elements has a ul element as its ancestor <ul> <li>Item 1</li> <li> <ol> <li>Sub-item 2A</li> <li>Sub-item 2B</li> </ol> </li> </ul> Now in css say we want to use it we will do for example ul li { ..... declarations } and oh We can also use descendant selectors to match the li elements within the ol in the example above
20th Oct 2016, 4:21 AM
Reco Narain
Reco Narain - avatar