|
Posted by Harlan Messinger on 12/07/57 11:56
David Woods wrote:
> "City Dweller" <dc_dweller@hotmail.com> wrote in message
> news:1156536935.284283.171710@p79g2000cwp.googlegroups.com...
>> Hello everyone,
>>
>> Hope someone can explain this to me....
>>
>> <style>
>> h1#jo { color: red }
>> </style>
>>
>> <h1 id="jo" style="color: yellow">ABC</h1>
>>
>> All browsers display ABC in yellow. Why? According to CSS specs, the
>> specificity of "color: yellow" is 100 since it is a STYLE attribute
>> inside a tag. However, the specificity of "color: red" is 101, a = 1
>> for #id, b = 0, and c = 1 for h1.
>>
>> So I would think ABC should be red not yellow. Where is the flaw in my
>> calculations?
>>
>> Thanks.
>>
>> -- City Dweller
>
> Inline style takes precedence over internal style sheet which in turn
> takes precedence over external style sheet.
Order is considered only after weight and origin and specificity. Origin
is concerned with author sheet versus user sheet versus browser default
sheet, not inline versus internal versus external. Inline takes
precedence over internal or external only indirectly, by virtue of the
fact that styled body elements come after internal stylesheets and
linked external stylesheet references--but, again, order is considered
only after specificity.
[Back to original message]
|