Skip to content
techsnow

CSS Selectors

Combinators

Combinators select elements based on their relationship to other elements.

CombinatorExampleSelects
Descendant (space)nav aEvery <a> anywhere inside <nav>
Child >ul > liOnly direct <li> children of <ul>
Adjacent sibling +h2 + pThe <p> immediately after an <h2>
General sibling ~h2 ~ pEvery <p> after an <h2> with the same parent
nav a { color: white; }
.menu > li { display: inline-block; }
h2 + p { font-size: 1.2em; }