HTML & CSS · Junior · Question 16 of 75
Both selectors set color on the same link. Which wins: #nav a or .menu .item a.link?
- 1
.menu .item a.link- it has more selectors, so it is more specific - 2Whichever comes later in the CSS file: order beats specificity
- ✓Correct answer:
#nav a- a single ID outweighs any number of classes
Explanation
Specificity is compared column by column (IDs, classes/attributes/pseudo-classes, types): #nav a = (1,0,1), .menu .item a.link = (0,3,1). The first column matters most, so the ID wins. Source order only decides when specificity is equal.