Quiz Entry - updated: 2026.07.05
What is the basic syntax of a CSS rule, and what are its parts called?
A CSS rule is a selector followed by a declaration block in curly braces, and each declaration inside is a property: value; pair.
CSS works by selecting HTML elements and assigning a style to that selection. The anatomy is small but the vocabulary matters because everyone uses these exact terms:
p {
color: blue;
font-size: 16px;
margin-bottom: 10px;
}
- Selector —
phere — picks which elements the rule applies to (in this case every paragraph). - Declaration block — the
{ ... }— holds one or more declarations. - Declaration — e.g.
color: blue;— one styling instruction, ending in a semicolon. - Property —
color— the thing you are setting. - Value —
blue— what you set it to.
A common beginner bug is forgetting the semicolon between declarations; without it the browser may silently ignore the rest of the block. The rule shown sets every paragraph's text colour to blue, its font size to 16 pixels, and adds a 10-pixel gap below it.
Go deeper:
CSS selectors (MDN) — the canonical overview of selector + declaration syntax and every selector type that follows.