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 | |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access