Adjacent Sibling Selector: element1 + element2

Pattern:

element1 + element2

 

Definition:

The element1 + element2 selector matches every element2 where element1 and element2 are sibling elements that share the same parent in the document tree, and element1 immediately precedes element2 (non-element nodes between element1 and element2 is ignored). 

 

Examples:

Style every <p> element that is placed immediately after <h1>

h1 + p { font-size: large; }

 

div.important + * { font-weight: bold; }
w10schools
2014-11-10 04:41:59
+
Comments
Leave a Comment

Please login to continue.