Home
CSS
CSS Combinators
Tryit: The general sibling selector
Run ❯
Get your
own
website
Result Size:
625 x 534
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <head> <style> div ~ p { background-color: yellow; } </style> </head> <body> <h2>General Sibling Selector</h2> <p>The general sibling selector (~) selects all elements that are next siblings of a specified element.</p> <p>Paragraph 1.</p> <div> <p>Paragraph 2.</p> </div> <p>Paragraph 3.</p> <code>Some code.</code> <p>Paragraph 4.</p> </body> </html>