right, Klaus, specificity resolves conflicts.

if your main site css uses !important on any element which conflicts
with your candy css, that could create a conflict in your candy, which
would resolve in favor of the site's css-- causing your candy to
display wrong! (even though you used !important).

fortunately, !important seems to be used rarely, so such a conflict is
unlikely to arise.

if, by rare chance, your site's css has a conflicting !important, then
you might be able to override it with some javascript and
getOverrideStyle. (or, runtimeStyle is an IE-only option)

w3.org states:
"getOverrideStyle method provides a mechanism through which a DOM
author could effect immediate change to the style of an element
without modifying the explicitly linked style sheets of a document or
the inline style of elements in the style sheets. This style sheet
comes after the author style sheet in the cascade algorithm and is
called override style sheet. The override style sheet takes precedence
over author style sheets. An "!important" declaration still takes
precedence over a normal declaration. Override, author, and user style
sheets all may contain "!important" declarations. User "!important"
rules take precedence over both override and author "!important"
rules, and override "!important" rules take precedence over author "!
important" rules." 
http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/css.html#CSS...

in other words, an "override" style marked "!important" is the CSS of
highest-precedence, in the CSS-hierarchy.

if your candy's css has conflicting declarations WITHIN ITSELF, then,
unless it's a bug in the candy, it's a conflict intended, by the candy
designer, to be resolved by specificity-- and applying !important to
ALL elements within the candy will have no effect on the intended
behavior of the candy—other than the joyful benefit of insulating your
candy from the site’s css!

Reply via email to