CSS Selectors

Child

An example of a CSS Child selector would be this...

span {
    background-color: white;
}
div > span {
    background-color: DodgerBlue;
}

The results:

Span #1, in the div. Span #2, in the span that's in the div.
Span #3, not in the div at all.

Descendant

An example of a CSS Descendant would be this...

li {
     list-style-type: disc;
}
li li {
     list-style-type: circle;
}

The results:

  • Item 1
    • Subitem A
    • Subitem B
  • Item 2
    • Subitem A