Appendix A. Selectors reference
Selectors target specific elements on the page for styling. CSS provides a wide array of selector types.
A.1. Basic selectors
- tagname—Type selector or tag selector. This selector matches the tag name of the elements to target. Has a specificity of 0,0,1. Examples: p; h1; strong.
- .class—Class selector. Targets elements that have the specified class name as part of their class attribute. Has a specificity of 0,1,0. Examples: .media; .nav-menu.
- #id—ID selector. Targets the element with the specified ID attribute. Has a specificity of 1,0,0. Example: #sidebar.
- *—Universal selector. Targets all elements. Has a specificity of 0,0,0.
A.2. Combinators
Combinators join multiple simple selectors into one complex selector. ...