docs.rodeo

MDN Web Docs mirror

CSS selectors

CSS selectors are patterns used in CSS rules to target and select specific elements for styling.

[!NOTE] This page is an index of all selectors in CSS. The CSS selectors page introduces the module that defines some, but not all, of these selectors.

For example, to style paragraphs, you will use the p type selector to select all {{HTMLElement("p")}}  elements and apply a style to them:

/* Set font size on all <p> elements */
p {
  font-size: 12px;
  color: rebeccapurple;
}

Syntax

/* Select elements and apply styles */
selector {
  property: value;
}

Index of selectors

Specifications

{{Specifications}} 

Check the pseudo-classes and pseudo-elements pages for their respective specification tables.

See also

In this article

View on MDN