Skip to content

CSS Selectors

Adjacent Sibling

About

The adjacent sibling combinator + matches if the second element immediately follows the first element.

Adjacent siblings

The selector matches .two elements that are immediately preceded by a .one element.

Non-adjacent siblings

If there is another element between .one and .two, the selector does not match. Here, the .separator element breaks the adjacency.