Next-sibling Combinator (+)
W3C CSS Snapshot 2026
Choose an element that comes immediately after another element under the same parent.
On this page
Syntax and values
| Value or syntax | What it does |
|---|---|
h2 + p | Matches a p only when its immediately preceding element sibling is an h2. |
Try the example
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Next-sibling Combinator (+)</title>
<style>
h2 + p { color: teal; font-weight: bold; }
</style>
</head>
<body>
<section>
<h2>Workshop</h2>
<p>Registration opens Monday.</p>
<hr>
<p>Bring a notebook.</p>
</section>
<p>Outside the section.</p>
</body>
</html>
What to expect The first paragraph inside the section changes. The divider prevents the second from matching.