/* Paragraphs that come immediately after any image */
img + p {
font-weight: bold;
}Next-sibling combinator / notebook
Next-sibling combinator
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
<ul>
<li>One</li>
<li>Two!</li>
<li>Three</li>
</ul>li:first-of-type + li {
color: red;
font-weight: bold;
}<ul>
<li>One</li>
<li>Two</li>
<li>Three!</li>
<li>Four</li>
</ul>li:has(+ li:last-of-type) {
color: red;
font-weight: bold;
}