O'Reilly logo

HTML5 and CSS3: Visual QuickStart Guide, Seventh Edition by Bruce Hyslop, Elizabeth Castro

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

9. Defining Selectors

In This Chapter

Constructing Selectors

Selecting Elements by Name

Selecting Elements by Class or ID

Selecting Elements by Context

Selecting Part of an Element

Selecting Links Based on Their State

Selecting Elements Based on Attributes

Specifying Groups of Elements

Combining Selectors

Selectors Recap

As you saw in “Constructing a Style Rule” in Chapter 7, there are two principal parts of a CSS style rule. The selector determines which elements the formatting will be applied to, and the declarations define just what formatting will be applied. In this chapter, you’ll learn how to define CSS selectors.

While the simplest selectors let you format all the elements of a given type—say, all the h1 headings—more complex selectors ...

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