O'Reilly logo

Cascading Style Sheets (CSS) by Example by Steve Callihan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using a Group Selector to Set the Other Heading Characteristics

The example file includes three different heading elements: H1, H2, and H3. Instead of separately setting the display properties for the H2 and H3 elements, you can set properties for both of these elements at the same time, using a group selector. In CSS, a group selector lets you select the properties you want applied to a group of elements (in this case, the H2 and H3 elements).

✓ For a fuller discussion of what grouping is and how it works, see “How Grouping Works,” p. 96 (chapter 5).

To group selectors within a single style rule, you just insert them as comma-separated lists. Here's an example of using an RGB hexadecimal color code to set a slate blue text color for both the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required