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

Get Getting StartED with CSS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.