On 18 Jan., 19:16, Ricardo Tomasi <ricardob...@gmail.com> wrote:
> They're named **Cascading** Style Sheets for a reason. Third party
> "CSS Candy" that is supposed to be inserted in other's pages should be
> coded with this issue in mind, protecting all it's styles in it's own
> container, or writing styles in-line (if it's not meant to be
> altered). If this has not been done it is indeed badly written code.
Inline styles are not a guarantee that a websites CSS would not
cascade into that widget. Although inline styles have highest
specificity, declarations with "!important" will still override those
inline styles. They do not in IE but that is a different story.
> I realize you're not aware of the issues that arise from your
> "solution". There is also a reason why !important is seldomly used:
> because it makes a mess of figuring out which style is being applied
> by overriding the cascading - eased by the use of firebug inspection
> or similar of course, but a mess nonetheless.
I tend to agree. When I do write CSS I almost always try to avoid "!
important" and consider it bad practice. Most of the time it turned
out to cause you more problems than do any good.
I think the solution for a 3rd party widget though should be to use a
unique identifier plus important declarations to 1. protect messing up
the site's CSS where it's included in while 2. at the same time
maintaining its own styles.
Nevertheless there is no guarantee that the site's CSS will not
override styles unless you use an iframe or object element to include
that widget.
--Klaus