Child

Avatar of Sara Cope
Sara Cope on (Updated on )

UGURUS offers elite coaching and mentorship for agency owners looking to grow. Start with the free Agency Accelerator today.

A child combinator in CSS is the “greater than” symbol, it looks like this:

ol > li {
  color: red;
}

It means “select elements that are direct descendants only”. In this case: “select list items that are direct descendants of an ordered list”. To illustrate:

<ol>
  <li>WILL be selected</li>
  <li>WILL be selected</li>
  <ul>
     <li>Will NOT be selected</li>
     <li>Will NOT be selected</li>
  </ul>
  <li>WILL be selected</li>
</ol>

Try removing the > symbol when playing around with the demo below:

See the Pen f149edb15c53d157a7009b816ee919d2 by CSS-Tricks (@css-tricks) on CodePen.

More Information

Also Known As…

The child combinator is what the spec calls it, but you’ll also hear it called:

  • child selector
  • direct descendent selector
  • direct descendant combinator

Browser Support

Chrome Safari Firefox Opera IE Android iOS
Any Any Any Any 7+ Any Any