CSS Selectors

CSS selectors are used to target HTML elements and apply styles to them.



Element Selector

Targets elements by their tag name.

Tutorials dojo strip
CSS


Class Selector

Targets elements with a specific class attribute, using a dot ( . ).

CSS


ID Selector

Targets an element with a specific ID attribute, using a hastag ( # ).

CSS


Universal Selector

Targets all elements on the page.

CSS


Group Selector

Applies the same styles to multiple selectors, separated by commas.

CSS


Descendant Selector

Targets elements that are descendants of another element.

CSS


Child Selector

Targets direct children of a specified element.

CSS


Adjacent Sibling Selector

Targets an element immediately following a specified element.

CSS


General Sibling Selector

Targets all sibling elements following a specified element.

CSS


Attribute Selector

Targets elements based on their attribute values.

CSS




CSS Selector Example Code

CSS




CSS Labs

Tutorials dojo strip