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

Page:    1 2 >

With CSSW, it is possible to apply styles to multiple selectors. As an example, suppose we have the following three rules:

h1 { background: yellow; }
h2 { background: yellow; }
h3 { background: yellow; }

We can combine these rules into one rule featuring the common style and the three different selectors by separating the three selectors (h1, h2, and h3) with commas, as shown here:

h1, h2, h3 { background: yellow; }

This grouping avoids needless code repetition.

(Continued on page 2)

Page:    1 2 >