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

Constructing Selectors

The selector determines which elements a style rule is applied to. For example, if you want to format all p elements with the Times font, 12 pixels high, you’d need to create a selector that identifies just the p elements while leaving the other elements in your code alone. If you want to format the first p in each section with a special indent, you’ll need to create a slightly more complicated selector that identifies only those p elements that are the first element in their section of the page.

A selector can define up to five different criteria for choosing the elements that should be formatted:

• The type or name of the element .

The simplest kind of selector is simply the name of the type of element that should be ...

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