Chapter 3. Selectors, Class, and Style
In This Chapter
Modifying specific named elements
Adding and modifying emphasis and strong emphasis
Creating classes
Introducing spans and divs
Using pseudo-classes and the link tag
Selecting specific contexts
Defining multiple styles
You know how to use CSS to change all the instances of a particular tag, but what if you want to be more selective? For example, you might want to change the background color of only one paragraph, or you might want to define some special new type of paragraph. Maybe you want to specify a different paragraph color for part of your page, or you want visited links to appear differently from unselected links. The part of the CSS style that indicates what element you want to style is a selector. In this chapter, you discover powerful new ways to select elements on the page.
Selecting Particular Segments
Figure 3-1 illustrates how you should refer to someone who doesn't appreciate your Web development prowess.
Defining more than one kind of paragraph
Apart from its cultural merit, this page is interesting because it has three different paragraph styles. The introductory paragraph is normal. The quote is set in italicized font, and the attribution is monospaced and right-aligned.
Figure 3.1. This page has three different kinds of paragraphs.
The quote in the following code was generated by one of my favorite sites on the Internet: ...
Get HTML, XHTML, and CSS All-In-One Desk Reference For Dummies® 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.