Suppose I have two files containing styles, a.css and b.css. I import them into my page in the <head>
section. Both of these external files define a style for the class .someclass
. Which one takes precedence? Is there any guarantee based on the order of the imports for css files that will state which style should be used?
They are cascading style sheets. Later definitions with the same specificity override earlier ones. More specific definitions take precedence over less specific definitions.
You can find exactly how the standard defines it (for CSS2) at http://www.w3.org/TR/CSS21/cascade.html.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With