W3C home > Mailing lists > Public > www-style@w3.org > September 1997

Re: Cascading, Inheritance, and Precedence

From: eva <eva@algonet.se>
Date: Fri, 19 Sep 1997 19:13:46 +0200
Message-Id: <199709191716.NAA07501@www10.w3.org>
To: <www-style@w3.org>
 Eric A. Meyer <eam3@po.cwru.edu>


>Given the CSS rules...
>     body {color : #FFFFFF;}
>     h1 {color : #FF0000;}
>...will H1 text be white, or red?
>   I originally claimed that specificity would cause H1s to be red, and
>then reversed myself, because under the weighting rules defined in Cascade
>Rule 4, both statements have the same specificity.

H1 will be red. In this case Rule 1 applies and hence the search is ended.

>Therefore, the tie is
>broken by Rule 5, which says later declarations win out over earlier ones.
>   This brings me to my question.  Given the CSS rules...
>     h1 {color : #FF0000;}
>     body {color : #FFFFFF;}
>
>...NOW what color will H1 text be?  Under my previous reasoning, it should
>be white, because the BODY rule comes after the H1 rule.  This just seems
>wrong, though.

H1 will still be red. As I understand it, Rule 5 says: "if there are two
conflicting declarations the one specified later wins. In other words:

h1 {color: red}
h1 {color: blue}

H1 will be blue

/e
Received on Friday, 19 September 1997 13:16:40 GMT

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