selector

child — CSS reference

Requires B to be an immediate element child of A. A nested descendant with an intervening wrapper does not match.

Formal Syntax & Structure

css syntaxcss
A > B

Working Example

Example Snippetcss
<!doctype html><html lang="en"><head><meta charset="utf-8"><title>Selector lab</title><style>:where(.sample) { color: rgb(32, 32, 32); }section > p { color: rgb(0, 96, 80); }</style></head><body><section><p id="a" class="sample">A</p><div><p id="b" class="sample">B</p></div></section></body></html>
CSS Reference