Selecting Elements by Name

Perhaps the most common criteria for choosing which elements to format is the element’s name or type. For example, you might want to make all of the h1 elements big and bold and format all of the p elements with a sans-serif font.

Figure 9.6. Our (X)HTML code has two h2 elements.

To select elements to format based on their type:

Type selector, where selector is the name of the desired type of element, without any attributes (Figure 9.7).

Figure 9.7. This selector will choose all of the h2 elements in the document.

✓ Tips

  • Unless you specify otherwise (using the techniques in the rest of this chapter) all the elements ...

Get HTML, XHTML, & CSS, Sixth Edition: Visual QuickStart Guide 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.