O'Reilly logo

HTML, XHTML, and CSS: Your visual blueprint™ for designing effective Web pages by Rob Huddleston

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

Chapter 9. WORKING WITH OTHER CSS SELECTORS

Apply Styles to More than One Element at a Time

Often, you will have several elements to which you want to apply the same style. Writing separate declarations for these elements is not only needlessly redundant, but it also makes updating the styles difficult. For example, say you wished to apply a text color to paragraphs and first- and second-level headings. It would work to write three separate declarations, setting the color in each, but if you later decided you wanted a different color, you would need to change all three to retain consistency.

To solve this issue, CSS allows you to create declarations that contain multiple selectors. So long as you plan to apply the exact same style rules to each ...

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