Skip to content

CSS Selectors

General Sibling

About

The general sibling combinator ~ matches the elements that are siblings of a given element. It is similar to the adjacent sibling combinator, but it doesn't require the elements to be immediately after each other.

General siblings

The selector matches .three elements that are siblings of .one elements. There can be any number of elements between .one and .three.

Non-siblings

The selector doesn't match .three elements that are not siblings of .one elements but are nested inside another element.