CSS element+element Selector

Complete CSS Reference Complete CSS Reference

Example

How to style all <p> elements that are placed immediately after a <div> element:

div+p
{
background-color:yellow;
}

Try it yourself »

Definition and Usage

The element+element selector styles a specified element that is placed immediately after (not inside of) a specified element.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The element+element selector is supported in all major browsers.

Note: For element+element to work in IE, a <!DOCTYPE> must be declared.


CSS Version

The element+element selector was first introduced in:

CSS 2


Complete CSS Reference Complete CSS Reference