selector
subsequent-sibling — CSS reference
Targets later B siblings of A under the same parent; intervening elements are allowed. It cannot select earlier siblings.
Formal Syntax & Structure
css syntaxcss
A ~ BWorking Example
Example Snippetcss
<!doctype html><html lang="en"><head><meta charset="utf-8"><title>Selector lab</title><style>:where(.sample) { color: rgb(32, 32, 32); }h2 ~ p { color: rgb(0, 96, 80); }</style></head><body><p id="b" class="sample">B</p><h2>Title</h2><div>Note</div><p id="a" class="sample">A</p></body></html>