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 ...
Get Cascading Style Sheets: Designing for the Web, Third Edition 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.