CSS Selector Level 3 » General sibling combinator

The general sibling combinator selects all silbings of the used element, but just occurs of silbings after the element will be selected.

# Syntax

E ~ F {
    /* declarations */

# Example

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

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

Try example in CodePen

# Browser support

Platform Chrome Firefox Safari Edge Internet Explorer Opera
Desktop Yes (1.0) Yes (1.0) Yes (3.1) Yes (12.0) Yes (7.0) Yes (9.2)

Please wait a moment, the comments start loading now...