🚀 We are hiring! See open positions

How to select following siblings using CSS selectors?

by Bernardas Alisauskas May 29, 2023 1 min read

To select the following sibling (i.e. sibling that is below the current element) the + and ~ combinators can be used.

The ~ selects any following general sibling:

<article> <p>ignore</p> <p class="ad">ignore</p> <p>select</p> <p>select</p> </article>

The + selects one following adjacent sibling (i.e. has to be right below it):

<article> <p>ignore</p> <p class="ad">ignore</p> <p>select</p> <p>ignore</p> </article>
Scale Your Web Scraping
Anti-bot bypass, browser rendering, and rotating proxies — all in one API. Start with 1,000 free credits.
No credit card required 1,000 free API credits Anti-bot bypass included
Not ready? Get our newsletter instead.