The subsequent-sibling combinator (~) matches every element that follows another sibling, shares the same parent, and matches the second selector. Elements may sit between them.
MDN also calls it the general sibling combinator. Use it for patterns like “all paragraphs after a heading” or “every span after a paragraph.”
Baseline Widely available.
Long-supported CSS combinator. Safe for production layouts across modern browsers.
Note — forward only.
~ never styles earlier siblings. To look backward, use :has(~ …). For only the next sibling, use +.
Syntax
CSS Syntax
syntax.css
former~target { … }
Whitespace around ~ is optional but recommended. Example: h2 ~ p.
Choose by need. All later siblings → ~; one next sibling → +.
Edge Cases & Pitfalls
Most misses come from parent boundaries or looking the wrong direction.
parent
Must share a parent
Nested elements are not siblings. Use the child or descendant combinator for those.
direction
Forward only
p ~ h2 never styles a heading that comes before a paragraph. Use :has(~ …) to look backward.
vs +
Do not confuse with +
+ stops at the immediate next sibling. Reach for it when one match is enough.
gaps
Gaps are allowed
Unlike +, other siblings between the former and target do not break ~.
space
Spaces are optional
h2~p and h2 ~ p are both valid. Prefer spaces for reading.
Compatibility
Browser Support
The ~ combinator is a browser CSS selector. Node.js, Deno, and Bun do not evaluate it.
✓ Baseline · Widely available
General sibling (~)
Supported in all major browsers for decades (Baseline Widely available since about July 2015). Safe for production layouts.
99%All modern browsers
Google ChromeAll
Full
Mozilla FirefoxAll
Full
Apple SafariAll
Full
Microsoft EdgeAll
Full
OperaAll
Full
Samsung InternetAll
Full
Internet Explorer7+
Full
former ~ targetUniversally supported
Bottom line: Production-ready. Remember: ~ matches all following siblings; use + for only the next one. Not a server runtime API.
Remember
Key Takeaways
Role: select all following siblings that match the second selector.
Form:former ~ target under the same parent.
vs +: all following siblings vs only the next one.
Tip: look backward with :has(~ …), not with bare ~.
One line:A ~ B styles every following sibling B after A.
Frequently Asked Questions
The ~ combinator (subsequent-sibling) matches every element that follows the first selector, shares the same parent, and matches the second selector. Elements in between are allowed.
+ matches only the immediate next sibling. ~ matches all following siblings that fit the second selector.
No. With ~, other siblings can sit between the former element and the targets. They must still share one parent.
Not by itself—it only looks forward. To style an earlier sibling, use :has(~ …) or :has(+ …).
Whitespace around ~ is optional but recommended for readability. Both h2~p and h2 ~ p are valid.
No. It is a browser CSS combinator, not a Node.js feature.