<link rel="stylesheet" href="css/css.css">
<link rel="stylesheet" href="css/css2.css">
imagine in the first stylesheet is says h1 color blue. Imagine the second stylesheet says h1 color red. Which one wins?
<link rel="stylesheet" href="css/css.css">
<link rel="stylesheet" href="css/css2.css">
imagine in the first stylesheet is says h1 color blue. Imagine the second stylesheet says h1 color red. Which one wins?
there exists an order for style sheets according to their priority
Browser Defaults
External Style Sheets (Linked or Imported)
Internal Style Sheets (Embedded)
Inline Styles
In any of the methods, if the same style names are used, the last priority is higher than all the same names
I'm actually not sure, what happens if two css have the same name. I would assume it doesn't matter.
What does matter for sure is the order of css files. Files, which are included later have a higher priority in case of same selectors. So yes, the second one would win.
More important is even the selector. If a selector is more specific than another one, the more specific wins. E.g. body h1
is more specific than h1
and would win - even if included before the h1
.
The only way to go around that, is to find either a more specific selector - or the same specific selector if included later - or to use !important
.