Last active
September 30, 2021 10:06
-
-
Save melvinstanly/e1851f59d5aeb1203912ed777a9ede4f to your computer and use it in GitHub Desktop.
CSS Specificity
This file contains 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
CSS rules have weight, and you should leverage those rules to correctly cascade styles. | |
element = 1 pt | |
class = 10 pt | |
id = 100 pt | |
inline = 1000 pt | |
An ID has a relatively high specificity of 100. A class has a specificity of 10. | |
#idname.classname - Now this selector has a specificity of 110. | |
div#idname.classname - Now this selector has a specificity of 111 (because an element has a specificity of 1). | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment