Main content
Unlisted resources area
Course: Unlisted resources area > Unit 2
Lesson 2: Webpage documentation- HTML: The h1 to h6 tags
- HTML: The p tag
- HTML: The br tag
- HTML: The ul, ol, and li tags
- HTML: The strong and em tags
- HTML: The a tag
- HTML: The image tag
- HTML: The table tags
- CSS: The element selector
- CSS: The descendant selector
- CSS: The class selector
- CSS: The id selector
- CSS: The color property
- CSS: The background-color property
- CSS: The font-family property
- CSS: The font-size property
© 2023 Khan AcademyTerms of usePrivacy PolicyCookie Notice
CSS: The descendant selector
The descendant selector is a way to select elements that are located somewhere underneath other elements, according to the tree structure of the webpage. This selector is actually multiple selectors combined together, but separated by a space. The first selector is the "ancestor", the element(s) that must be located higher in the tree, and the second selector is the "descendant", the element(s) that must be located somewhere underneath the ancestor in the tree.
To understand ancestor/descendant relationships, you need to think about the webpage is a tree. An example tree structure is shown in the image above. The
ul
is an ancestor of the em
below it, but it is not an ancestor of the other em
. That means that a "ul em" selector will only select a single em
, not both of them.