W3C home > Mailing lists > Public > www-style@w3.org > August 1999

Re: Competing classes

From: L. David Baron <dbaron@fas.harvard.edu>
Date: Fri, 13 Aug 1999 09:28:17 -0400 (EDT)
Message-Id: <199908131328.JAA16713@ice1.fas.harvard.edu>
To: braden@shadow.net, www-style@w3.org
On Fri, 13 Aug 1999 07:27:10 -0400, "Braden N. McDaniel"
(braden@shadow.net) wrote:
> Surely this case is specified and I just haven't been able to find it...
> 
>   .red { color: red }
>   .blue { color: blue }
> 
>   ...
> 
>   <p class="red blue">What color am I?
> 
> 
> Who wins, and why?

The paragraph is blue, because the ".blue" class was given after the
"red".  (Since both rules match the paragraph and have the same origin,
weight, and specificity, order decides. [1])

This behavior is tested in [2].

David

[1] http://www.w3.org/TR/REC-CSS2/cascade.html#cascading-order
[2] http://www.fas.harvard.edu/~dbaron/css/test/twoclass

L. David Baron     Rising Sophomore, Harvard     dbaron@fas.harvard.edu
Links, SatPix, CSS, etc.        < http://www.fas.harvard.edu/~dbaron/ >
Summer Intern, Netscape - however, opinions are entirely my own, etc.
Received on Friday, 13 August 1999 09:28:18 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:00 GMT