CSS Adjacent Sibling Selector
What is a CSS Adjacent Sibling Selector?
- The adjacent sibling selector specifies an element that immediately follows another element when both of the elements are siblings. Sibling elements share the same parent element. The syntax is two selectors separated by a plus (+) sign. The style is applied to the element specified on the right side of the plus sign when it immediately follows the element specified on the left. In the following example, the color property will be set to red for any <p> element that immediately follows a <h1> element. The style is NOT applied to the <h1> element and the last <p> element.