Declarations, Properties, and Values
A declaration is made up of a property name and a value, separated by a colon; whitespace characters can appear around any of these elements. A declaration must appear within a declaration block, like so:
h2 {
color: #666;
}
There’s a large collection of property names that we can use in our style rules. Syntactically, they are in fact CSS identifiers, and must be specified correctly, otherwise the declaration will be ignored. Property values can be specified in various forms, depending on the property in question—each property has its own syntactic and semantic requirements and restrictions. Values can be expressed as keywords, strings, colors, numbers, lengths, percentages, and URIs.
In this Section
- Keywords
- Lengths and Units
- Percentages
- Colors
- Numbers
- Strings
- URIs
- Initial Values
- Shorthand Properties
User-contributed notes
There are no comments yet.
Add a note
To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.
