Home › CSS Tutorial › CSS combinators
CSS combinators
Select by relationship.
Descendant (space), child (>), adjacent sibling (+), general sibling (~).
Example code
<style>
div p{color:blue}div>p{font-weight:700}h2+p{background:#ffd}
</style>
<h2>Head</h2><p>Right after h2</p><div><p>Child</p><section><p>Descendant only</p></section></div>