It is hard to explain css selector specificty, to easy way to understand it is by playing around with it.
To remember some rules can be helpful:
Which means if you have inline style in your html, even you try to use ID selector, it cannot override the inline style. That‘s why people recommend don‘t use inline style because it is hard to override.
First one is the winner.
[CSS3] Understand CSS Selector Specificity
原文:https://www.cnblogs.com/Answer1215/p/10100201.html