CSS rule

noun

say it: “SEE-ESS-ESS ROOL” /ˌsiːˌɛsˈɛs ruːl/

One styling instruction in CSS: a selector that picks elements, then curly braces holding the declarations that say how those elements look.

What is a CSS rule?

A CSS rule says which elements to style and how: a selector, then a block of declarations in curly braces.

.price {          /* selector */
  color: green;    /* declaration */
  font-weight: bold;
}

In a sentence

  • “I wrote one CSS rule that made every heading on the coffee shop menu dark brown.”
  • “The order button looked plain until I added a CSS rule for the .order-button class.”
  • “I wrote one CSS rule that makes every price on the coffee menu bold and green.”

Level: Novice · More CSS terms at this level

Updated