Last updated on

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

ol > li {
  margin: 5px;
}

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>

 

Browser Support

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

Leave a Reply

Your email address will not be published. Required fields are marked *