Created
February 14, 2024 10:09
-
-
Save chrislaughlin/7bf0c00d778ffe3c125f213b1b5a77c9 to your computer and use it in GitHub Desktop.
Specificity Showdown: Can You Guess the Winner?
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
The correct answer is A. Rule 1 (.container h2.special). Here's why: | |
Specificity is calculated based on the number of IDs, classes, and elements in the selector. | |
Rule 1 has one ID (.container), one class (.special), and one element (h2), giving it a value of 100 + 10 + 1 = 111. | |
Rule 2 only has one class and one element (10 + 1 = 11). | |
Rule 3 only has one ID and one class (100 + 10 = 110). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment