About CSS Syntax
Syntax is like grammar: rules of language.
- A CSS rule has two main parts:
- The selector
— Selects tags where the rule applies - A declaration block containing one or more declarations
— Declaration block is a pair of curly braces {}
— Each declaration has a property and value, separated by a colon (:)
— Each declaration ends with a semicolon
- The selector
- Example:
- The above example select <h1> tags, making them blue and setting their font size to 12px;
See also
- CSS Syntax @ w3schools.com
- CSS Reference @ w3schools.com
- CSS Interactive Tool @ w3schools.com
- Starting with HTML + CSS @ w3c.org