O'Reilly logo

Getting StartED with CSS by David Powers

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 7. How Do I Create Differently Styled Sections?

Way back in Chapter 1, I warned you that it's easy to slip into the habit of overusing CSS classes. If you examine the style sheet used in this book's main case study (you can find it in css/journey_20.css in the download files for this chapter), you'll see that it uses classes very sparingly. Instead, I have relied on using type selectors to redefine the default look of HTML tags. I have also used the adjacent sibling selector—such as h1 + p, which styles a paragraph only if it comes immediately after an <h1> heading—to target certain elements without the need to add class attributes to the HTML markup. Other selectors used so far include ID selectors, descendant selectors, and pseudo-classes. ...

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