liveBook · Manning

Descendant selector

As explained in Tiny CSS Projects

A descendant combinator is a CSS combinator, conventionally written as whitespace, that matches elements occurring anywhere within another selected element.

A descendant selector uses a space between selectors to target matching elements anywhere inside another element. It expresses an HTML relationship without adding more class or ID names. section 1.6.2

Double-space paragraphs inside an article

The selector `article p` finds paragraphs inside any `article`, including nested descendants, and can apply `line-height: 2` to make the article text double-spaced. section 1.6.2

Keep the relationship distinction clear:

  • A descendant selector reaches children, grandchildren, great-grandchildren, and deeper elements. section 1.6.2

How Tiny CSS Projects covers it

How deep it goes
Defines space-separated syntax, explains descendant depth, and contrasts it with immediate-child targeting.
Examples
Uses `article p` for double-spaced paragraphs and contrasts nested list items with `.list > li`.
What it assumes
Assumes basic HTML element relationships while introducing combinator syntax through parent, child, and descendant examples.
What you can do after
Apply it via CSS selectors to style matching elements at any depth within a chosen parent.
How it connects
Connects CSS combinators with HTML element relationships and the child combinator.

Also explained in

Compare how 3 books explain descendant selector →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Tiny CSS Projects. The section links point to the parts of the book it draws on.