Re: Precedence within a stylesheet

Did you ever have one of those years?  Just a few moments ago, I said:

>At 12:10 -0500 09/18/97, Andi Hindle wrote:
>>I'm trying to figure out what takes precedence over what in a stylesheet.
>>Thus, given:
>>
>>body { color : #FFFFFF;}
>>h1 {color : #FF0000;}
>>
>>will my <h1> turn out red or white?
>
>   If I read Section 3.2 of the specification correctly, your H1s will
>turn out red, assuming that both statements have the same origin.  I'm
>basing this on rule 4 (the specificity rule).  Since a declaration for H1
>is more specific than a declaration for BODY, it should win out.

As soon as I hit 'send,' I realized that I'd been incredibly stupid.  The
specification says no such thing.  According to rule 4, these would have
equal weight.
   My conclusion was still correct, though, because rule 5 (order
specified) says that the last applicable rule holds sway.  Therefore, since
the H1 rule comes after the BODY rule, it should win out.
   Between this and the 'sidebar' goofs I made a week or two back, I'm
starting to give serious consideration to just shutting the heck up and
becoming a monk or something.

--
Eric A. Meyer  -  eam3@po.cwru.edu  -  http://www.cwru.edu/home/eam3.html
 Hypermedia Systems Manager
 Digital Media Services                http://www.cwru.edu/dms/dms.html
 Case Western Reserve University       http://www.cwru.edu/

Received on Thursday, 18 September 1997 14:04:25 UTC