O'Reilly logo

CSS Pocket Reference, 4th Edition by Eric A. Meyer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

Adjacent Sibling Selector

Pattern:

element1 + element2

Description:

This allows the author to select an element that is the following adjacent sibling of another element. (Sibling elements, as the name implies, share the same parent element.) Any text between the two elements is ignored; only elements and their positions in the document tree are considered.

Examples:

table + p {margin-top: 2.5em;}
h1 + * {margin-top: 0;}

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required