- From: Hakon Lie <howcome@w3.org>
- Date: Fri, 19 Sep 1997 22:45:45 +0200 (MET DST)
- To: "Eric A. Meyer" <eam3@po.cwru.edu>
- Cc: www-style@w3.org
Eric A. Meyer writes:
> 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.
> Then I figured it out-- I think. The answer seems to be in Cascade Rule
> 1, which states:
>
> "Find all declarations that apply to the element/property in question.
> Declarations apply if the selector matches the element in question.
> If no declarations apply, the inherited value is used."
>
> Since there are H1 rules which do apply, those rules override any inherited
> property values.
> However, this is only the case if Cascade Rules with lower numbers have
> higher precedence-- something which the specification does not define.
> Does Rule 1 have more weight than Rule 5? If so, the problem is solved.
> If not... well, ick.
The specification states that "To find the value for an
element/property combination, the following algorithm must be
followed", then five numbered steps are described. This is another
way of saying that a lower number rule has higher precedence than a
higher number rule.
So, yes, the problem is solved.
Regards,
-h&kon
H å k o n W i u m L i e
howcome@w3.org http://www.w3.org/people/howcome
World W i d e Web Consortium
Received on Friday, 19 September 1997 16:45:54 UTC