HTML and CSS Reference
If multiple styles still exist, sort by specificity
The properties for a more specific contextual style (see section
defined for a less specific context.
If multiple styles still exist, sort by order
The property specified latest takes precedence.
The relationship between style properties and conventional tag attrib-
utes is almost impossible to predict. For instance, stylesheet-dictated
background and foreground colorswhether defined externally, at the
document level, or inlineoverride the various color attributes that may
appear within a tag. But the align attribute of an inline image usually
takes precedence over a style-dictated alignment.
Myriad style and tag presentation-attribute combinations exist. You
need a crystal ball to predict which combination wins and which loses
the precedence battle. The rules of redundancy and style-versus-attrib-
ute precedence are elucidated in the W3C CSS2 standard, but no clear
pattern of precedence is implemented in the styles-conscious browsers.
This is particularly unfortunate because there will be an extended peri-
od, perhaps several more years, in which users may or may not use
styles-conscious browsers. Authors must implement both styles and
nonstyle presentation controls to achieve the same effects.
Nonetheless, our recommendation is to runas fast as you canfrom one-
shot, inline, localized kinds of presentation effects such as those af-
forded by the <font> tag and color attribute. They have served their
temporary purpose; it's now time to bring consistency (without the
pain!) back into your document presentation. Use styles.