CSS Adjacent Sibling Combinator (+)

Definition and Usage

CSS Adjacent Sibling Combinator (+) is used to select an element that immediately follows another specific element.

Example

Select and set the style of the <p> element that immediately follows the <div> element (not inside it):

div + p {
  background-color: gold;
  border: 1px solid gray;
}

Try It Yourself

CSS Syntax

element1 + element2 {
  css declarations;
}

Technical Details

Version: CSS2

Browser Support

The numbers in the table indicate the first browser version that fully supports the combination.

Chrome Edge Firefox Safari Opera
Support 7.0 Support Support Support

Related Pages

CSS Tutorial:CSS Adjacent Sibling Combinator