Search⌘ K
AI Features

Sibling Selectors

Explore how to apply CSS sibling selectors to style HTML elements based on their adjacent and general sibling relationships. Understand the syntax and usage of the adjacent sibling selector (+) and the general sibling selector (~) to control the appearance of web page elements effectively.

Selecting HTML tags based on surrounding siblings

Often you need to select HTML tags that are based on their surrounding siblings. To carry out this task, CSS3 offers you two sibling selectors:

  1. the adjacent sibling selectors
  2. the general sibling selectors

The adjacent sibling selector selects all ...