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
Copy
E ~ F {
/* declarations */
}
# Example
Copy
h1 ~ p {
border-left: 1px solid gray;
}
This example will add a gray border-left to all p
's which are siblings of <h1>
.
# 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...