[thelist] css rendering myths and optimizing

Mark Howells mark at mountain.ch
Wed Mar 13 11:12:01 CST 2002


> When the external css is read by the
> browser it displays the last thing it reads first -so last rule read is
> first rule displayed. is this true?

Almost! What actually happens is that the style sheet is read from start to
finish and the last declared style is applied. Take this example:

p {color:#000;}
p.highlight {color:#f00}

In this example, the paragraph text will be black unless you use
class="highlight", in which case it will be red. But if you reverse the
declarations,

p.highlight {color:#f00}
p {color:#000;}

then all of the paragraphs will be black, including those using
class="highlight", as that is the "last" colour declaration.

Regards
Mark Howells
<http://www.mark.ac/evl/>




More information about the thelist mailing list