MDN self-hosted library · e01.org
Child combinator / notebook

Child combinator

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

css
/* List items that are children of the "my-things" list */
ul.my-things > li {
  margin: 2em;
}
html
<div>
  <span>
    Span #1, in the div.
    <span>Span #2, in the span that's in the div.</span>
  </span>
</div>
<span>Span #3, not in the div at all.</span>
css
span {
  background-color: aqua;
}

div > span {
  background-color: yellow;
}