Chances are if you're a web developer you're going to have to write some CSS from time to time. When you first looked at CSS it probably seemed lik...
For further actions, you may consider blocking this person and/or reporting abuse
I think it’s important to note that this is not how specificity is calculated. It is not a single number. Rather, each selector type is counted in a base-infinity count. The selector with the highest count of each in order is the one who wins.
.container #main a
= 1,1,1 not 111. A selector with 10 classes = 0,10,0 not 0100. This is why#main
would always beat.container
* 10.Thank you Jason! I should have clarified this further!
I noticed the article was clarified, and it's far better articulated than I could have done. Excellent work!
This is super helpful. I used it to calculate the order and winner of each class.
Glad it was helpful! I must admit: when I first learned this myself, it took a little bit of the magic away. 🤣
Great read, thanks for that! :)
For anyone looking for ways to see this stuff working under the hood, be sure to check out Chrome's debugger views for browser painting: developers.google.com/web/tools/ch...