Chapter 45. Changing the Look of a Text Element

In CSS, the simplest style selector is just the name of an HTML tag. The style definition for this simple selector determines how the browser displays the element wherever it appears on the page:

h1 {
  font-family: Arial;
  font-weight: bold;
}

p {
  font-family: Verdana;
}

So it goes for redefining the generic appearance of HTML text tags. But CSS allows you to choose much more specific selectors for entire sequences of tags to get precisely the typographical effect you have in mind, as Table 45.1 shows.

Table 45.1. CSS Selectors for HTML Tags
SELECTORDESCRIPTIONEXAMPLE SYNTAXEXAMPLE DESCRIPTION
SimpleAll HTML tags of a typepAll paragraphs
ContextualAll HTML tags of a type that are somewhere within a ...

Get Web Design Garage 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.