All excerpts and extracts are from the CSS2 Specification (May 12, 1998). They are colored dark blue on this page. Numbers in brackets refer to the pertinent sections in the Specification.

Parts of a Style Sheet

Rule or Rule Set

A rule set (also called "rule") consists of a selector followed by a declaration block. [4.1.7]


The selector consists of everything up to (but not including) the first left curly brace ({). A selector always goes together with a {}-block. When a user agent can't parse the selector (i.e., it is not valid CSS2), it must ignore the {}-block as well. [4.1.7]

Declaration Block

A declaration-block (also called a {}-block in the following text) starts with a left curly brace ({) and ends with the matching right curly brace (}). In between there must be a list of zero or more semicolon-separated (;) declarations. [4.1.7]


A declaration is either empty or consists of a property, followed by a colon (:), followed by a value. Around each of these there may be whitespace. [4.1.8]

An Example

Given the following simple style sheet:

		margin: 1em;
		color: black;
		background: white;
		font: italic 90% sans-serif;	

The style sheet above has only one rule or rule set. body is the selector of this particular rule. Everything inside the curly braces that follow the selector including both the opening and closing curly braces is called the declaration block. Each line inside the braces is a declaration. For instance margin: 1em is one such declaration out of four. Declarations are delimited by semicolons. Note that declarations need not be written on separate lines since what separates declarations from one another is the semicolon. background is a property and its value is white. In the last declaration the value of property font is italic 90% sans-serif. The semicolon that follows the last declaration is optional.