O'Reilly logo

HTML5 and CSS3: Visual QuickStart Guide, Seventh Edition by Bruce Hyslop, Elizabeth Castro

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

Specifying Groups of Elements

It’s often necessary to apply the same style rules to more than one element. You can either reiterate the rules for each element, or you can combine selectors and apply the rules in one fell swoop. Of course, the latter approach is more efficient and generally makes your style sheets easier to maintain.

Image The code contains one h1 and two h2 elements.

...<article id="gaudi" class="about">     <h1>Antoni Gaudí</h1>     <p>Many tourists are drawn ...</p>     <p>Barcelona ...</p>     <section class="project">        <h2 lang="es">La Casa Milà</h2>        <p>Gaudí's work was ...</p>     </section>     <section class="project"> ...

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