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.

User-contributed notes

There are no comments yet.

Related Products