Back To The Basics: CSS Specificity
CSS specificity is a big top in web development but having a good foundational understanding is essential to writing clean and well organized CSS.
All things being equal i.e. if you have the same rule in your style sheet twice then the latest rule is the one that will be enforced.
The more elements you include in a declaration if they are equal will take precedence
In terms of specificity the order is style attribute, id (#), class (.) or pseudo-class or attribute, then element
Check out codepen for the above
Read more about it here