Appendix A. CSS Selectors and Specificity
CSS Selectors Level 3
Pattern | Meaning | Specificity and examples |
Universal Selector The universal selector has no weight in terms of specificity. | 0-0-0 | |
| Matches any element. |
|
Type selector Type or element selectors have the lowest specificity. | 0-0-1 | |
| Matches elements of type
|
|
Class selectors | 0-1-0 | |
| Matches all elements whose
class list contains the class |
|
ID selectors | 1-0-0 | |
| Matches the element that
has an ID equal to |
|
Combinators Combinators,
including | 0-0-0 | |
| Matches elements |
|
| Matches elements |
|
| Matches the element
|
|
| Matches all elements
|
|
Attribute selectors Attribute selectors have the same specificity as the class selector. | 0-1-0 | |
| Matches elements |
|
| Matches elements |
|
| Matches elements |
|
| Matches elements |
Get Mobile HTML5 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.