CSS Selector Level 3 » General sibling combinator

The general sibling combinator selects all siblings F of the specified element E, but only those siblings that occur after the element E in the DOM tree will be selected.

# Syntax

E ~ F {
    /* declarations */

# Example

h1 ~ p {
    border-left: 1px solid gray;

This example will add a gray border-left to all p's which are siblings of <h1>.

Try example in CodePen

# Browser support

Platform Chrome Firefox Safari Edge Internet Explorer Opera
Desktop Yes (1) Yes (1) Yes (3.1) Yes (12) Yes (7) Yes (9.2)

Please wait a moment, the comments start loading now...
explorermozillachromesafariopera info external