0

Possible Duplicate:
Two css files defining same class

The answers to this question and this question state that when the same selector/property combination is specified in two different CSS files, the one in the file that is included last wins. My question is, is this behavior part of a standard (HTML or CSS), or is it simply the current behavior in the major browsers? I need to know if I can depend on this behavior across all browsers. If this is part of a standard, would you please reference the relevant section?

Community
  • 1
  • 1
James Curtis
  • 784
  • 4
  • 15

2 Answers2

5

Finally, sort by order specified: if two declarations have the same weight, origin and specificity, the latter specified wins.

http://www.w3.org/TR/CSS21/cascade.html#cascading-order

The same applies if they are in the same file.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
0

is this behavior part of a standard (HTML or CSS)

Yes, the CSS standard defines it.

In 6.4.1 Cascading order, bullet point #4:

Finally, sort by order specified: if two declarations have the same weight, origin and specificity, the latter specified wins. Declarations in imported style sheets are considered to be before any declarations in the style sheet itself.

Oded
  • 489,969
  • 99
  • 883
  • 1,009