Skip to: content, navigation

by Tommy Olsson and Paul O’Brien

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

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.

Related Products

The Principles of Beautiful Web Design

Best Seller!

You don’t need to go to Art School to design great looking web sites!

Book Cover: The Principles of Beautiful Web Design

Download the FREE sample chapters