About HTML class attribute assigned with two or more class names, that is,
<tag class="a b">....</tag>
I can test it with different browsers — see tests at http://jsfiddle.net/PP9yf/1/ or this question/answer
— and deduce a common sense rule:
use
class="a"if it is defined, or useclass="b"if it is defined, or use BOTH if both defined… And, when using both, if they assign same property, the last CSS definition overrides the others.
So, we can interpret for example that class="a b" must be the same as class="b a".
But it is a W3C official interpretation?
Where the W3C standard that say this rule?
PS: I started with this other question, but my motivation is software development. I need this normative answer to develop a software similar to emogrifier, etc.
Example: CssToInlineStyles need this correction… But only need a "correction" IF there are a W3C standand saying that the software is wrong.
Your findings are correct, and they are official W3C specification.
Two classes on the element itself have the same ‘origin’. Also, the selectors have the same ‘weight’.
Since these and other rules don’t determine which style has priority, the order of the style sheet determines the overrule.
See Cascading Style Sheets, level 1, paragraph 3.2 for the rule that specifies this. 3.2.1 through 3.2.4 don’t differentiate between any of the two styles. It is 3.2.5 that prevails.
I will cite the rules here, although you may want to read the document to place them in context.
Summarizing
We can translate the common sense rule itens in the W3C CSS1 rule 3.2 itens,
«use class="a" if it is defined, or use class="b" if it is defined, or use BOTH if both defined» is equivalemnt to 3.2.1, «Declarations apply if the selector matches the element in question».
«the last CSS definition overrides the others» is equivalemnt to 3.2.5 , «the latter specified wins».
Not changed with new standars: CSS2, CSS2.1 and CSS3 use the same rules.