Export (0) Print
Expand All

Adjacent sibling

Specifies an adjacent sibling relationship between selector elements.

E + F { sRules }

E

String that specifies the name of a document language element type or simple selector.

F

String that specifies the name of a document language element type or simple selector.

sRules

String that specifies one or more cascading style sheet property/value pairs.

The adjacent sibling combinator is a plus-sign character (+) that separates two simple selectors. White space is not significant.

A selector of the form "E+F" matches element F when it follows sibling element E in the document tree, ignoring non-element nodes (such as text nodes and comments). Elements E and F must share the same parent and E must immediately precede F. To match the first child of the parent, use the :first-child pseudo-class.

The following example reduces the vertical space that separates an H1 element and the H2 element that immediately follows it:

<style>
    h1 + h2 {margin-top: -5mm;}   
</style>

Community Additions

ADD
Show:
© 2014 Microsoft