CSS3 Subsequent Sibling Combinator (~)
- Previous Page Selector List Combinator
- Next Page Child Element Combinator
- Go Up One Level CSS Combinator Reference Manual
Definition and Usage
CSS Subsequent Sibling Combinator (~
) matching all elements after the first element (element1appearing after element2.
element1 and element2 must share the same parent element, but element2 Not necessarily immediately following element1 after.
Example
Select and set the style of all <ul> elements that follow the <p> element and share the same parent element:
p ~ ul { background-color: gold; border: 1px solid gray; }
CSS Syntax
element1 ~ element2 { css declarations; }
Technical Details
Version: | CSS3 |
---|
Browser Support
The numbers in the table indicate the first browser version that fully supports this compositor.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
4.0 | 7.0 | 3.5 | 3.2 | 9.6 |
- Previous Page Selector List Combinator
- Next Page Child Element Combinator
- Go Up One Level CSS Combinator Reference Manual