CSS: child selector (>)

By Xah Lee. Date: . Last updated: .

Match a Parent Tag (aka Child Combinator)

s1 > s2

Match s2 that is a direct child of s1.

Each expression can be compound selector.

Can also be chained like this:

a > b > c

/* any span that's direct child of div */
div > span {
 color: red;
}
<div>
 <span>match</span>
</div>

<div>
 <p>
  <span>no</span>
 </p>
</div>

CSS. Selectors

Selector types
Simple selectors
Combinators
Selector list
Special selector
Misc