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 ...

Get Cascading Style Sheets (CSS) by Example now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.