Child Combinator (>)

W3C CSS Snapshot 2026

Choose only direct children of the first selector.

On this page

Syntax and values

Value or syntaxWhat it does
section > pMatches p elements whose immediate parent is section.

Try the example

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Child Combinator (&gt;)</title>
  <style>
section > p { color: teal; }
  </style>
</head>
<body>
<section>
  <p>Direct child</p>
  <div><p>Nested paragraph</p></div>
</section>
<p>Outside the section</p>
</body>
</html>

What to expect Only the first paragraph turns teal. The nested paragraph has a div as its immediate parent.

Official references