How do I group declarations?
Author: Deron Eriksson
Description: This is a CSS example that demonstrates how to group declarations.
Tutorial created using: Windows XP

Page:    1 2 >

With CSSW, we can group multiple declarations into a single rule. As an example of this, suppose that we have the following two rules. Each rule pertains to the h1 selector. The first rule features the "background: yellow" declaration, where the "background" property has a value of "yellow". The second rule features the "color: red" declaration, where the "color" property has a value of "red".

h1 { background: yellow; }
h1 { color: red; }

These rules can be combined into one rule that has the h1 selector and the two declarations within the declaration block. Multiple declarations in a declaration block must be separated by semicolons.

h1 { background: yellow; color: red; }

(Continued on page 2)

Page:    1 2 >