At 20:17 +0100 on 10/01/2013, Philip Taylor wrote about Re: [css-d] Two classes, two conflicting rules, which wins :

Chris Rockwell wrote:

 That is why it works that way, yes.

 The engine sees two widths, both with the same weight, origin and
 specificity; the last one to be declared will win.

 If instead, you did:

 div.c1 {width:20em}
 .c2 {width:30em}

 The width would be 20em, because div.c1 is more specific.

Yes, the last example is clear; it was only the 'class="c1 c2"'
about which I was uncertain.

Philip Taylor

So you are saying that in a 'class="c2 c1"' case, it scans the CSS defs, sees .c1 and applies it, keeps going and sees .c2 which overrides the c1 width?

IOW: The order that you list the class in the HTML is ignored and only the order that the classes are defined in the CSS defs counts.
______________________________________________________________________
css-discuss [css-d@lists.css-discuss.org]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to