combinator

Descendant Combinator

Matches element B when it is a descendant (at any depth) of element A. It is written as whitespace between two selectors.

A B

Example

article p { line-height: 1.6; } /* All <p> inside <article> */

✓ Matches

  • <article><p>Hi</p></article>
  • <article><div><p>Nested</p></div></article>
  • <article><section><p>Deep</p></section></article>

✗ Does not match

  • <p>Outside</p> followed by an empty <article>
  • <section><p>Not in article</p></section>

Browser support

Universal support in all browsers since CSS1.

Related selectors

← All CSS selectors · CSS selectors cheat sheet