Example: Selecting siblings

In our example, notice the following:

  • The background colour pink appears only in the table data elements that are the next siblings of table header elements. In particular, there is no background colour applied to the last column of the first table.
  • The larger font is applied to all following siblings of the list item element in the class disc.

Note:

Hints:

  • undefined
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
<!DOCTYPE html>
<html lang="en">
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
th + td {
    background-color: pink;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX