A style rule is a statement that tells the browser how to render particular elements on an HTML page. A rule consists of a selector followed by a declaration block. The declaration block is everything between (and including) the braces ({ }). The following style rule modifies the default rendering of all H1 elements:
Selector | Declaration block |
|
---|---|---|
h1 | {font-variant: | small-caps;} |
| property | value |
A style declaration consists of a single property and a value pair, separated by a colon (:). White space inside a declaration block is ignored, so it can be used to format the rule for increased readability. Multiple declarations are separated by semicolons (;).
![]() |
---|
Although the semicolon is not required if there is only one declaration, it is a good coding practice to finish the last declaration in a block with a semicolon. |