MDN self-hosted library · e01.org
CSS combinators / notebook

CSS combinators

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

css
/* Set top margin on <p> elements that are direct children of <div> */
div > p {
  margin-top: 0;
}
css
/* Combine selectors to express relationships */
selector1 combinator selector2 {
  property: value;
}