Created
June 30, 2016 14:54
-
-
Save arkon/214372022df82211933f4098b1f516c0 to your computer and use it in GitHub Desktop.
Efficient CSS selectors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. ID, e.g. #headerClass | |
2. Class e.g. .promoType | |
3. Type e.g. div | |
4. Adjacent sibling, e.g. h2 + p | |
5. Child, e.g. li > ul | |
6. Descendant, e.g. ul a | |
7. Universal, i.e. * | |
8. Attribute, e.g. [type="text"] | |
9. Pseudo-classes/-elements, e.g. a:hover | |
Browsers read selectors right-to-left: #social .social-link {} is better than #social a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment