Example: Selecting children or descendants
The example contains a list, a table, and a table that contains a list.
- The first rule uses a child selector. It applies only to the ordered list element that is a child of a table data element.
- The second rule uses a descendant selector. It applies only to list item elements that are descendants of a table element.
- The third rule demonstrates the use of a combined selector
table#personality
as well as a descendant selector. The only table data elements that are styled are those in the table with the IDpersonality
.
(Here the caution gives good advice, though we will ignore it in order to practice using a combined selector.)
Note:
Hints:
- undefined
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
<!DOCTYPE html>
<html lang="en">
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
td > ol {
list-style-type: upper-alpha;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX