O'Reilly logo

Cascading Style Sheets: Designing for the Web, Third Edition by Bert Bos, Håkon Wium Lie

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

Chapter 4. CSS Selectors

In the preceding chapters, we used a number of selectors, most of which select elements by their type (for example, H1 or P). This chapter describes all the possible ways in which elements can be selected, from simple ones, such as the type selectors, to advanced, such as selectors that look for elements with a combination of characteristics.

We start with the simple selectors, and most common ones, and show how they can be combined into powerful – but still simple – selectors. The second half of this chapter discusses advanced selectors.

Selector Schemes

To give you enough freedom to select which elements a style is applied to, CSS2.1 supports four selector schemes. Each is based on some aspect of an element:

• An ...

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