ryan.joyce wrote: > unless you've declared some of your default styles as !important, > the widget *will* take precedence if it's called after the default > CSS.
--if you mean the widget styles will affect the main site rendering, not if the widget styles are correctly declared with unique id's or classes. > the only issues i can see are relative vs. explicit pixel sizes... --rendering problems of a widget, in my experience, could involve many, indeed EVERY attribute of every element in the widget. > Even in those cases it's be quicker, easier and > neater to just change your default CSS rather than replacing every > instance of ; with !important; in your imported stylesheet. --this solution is for cases where changing your default css, which will of course affect your main site rendering, is undesirable or impossible. for me, doing a global replace of ";" with " !important;" takes about 1/2 a second. on the other hand, fine-tuning my main site css so that the widget and the site both look right could potentially take hours of trouble-shooting, trial-and-error, and juggling precedence, including specificity, order of declaration, id's and classes, and so on. > it's a very inelegant solution to > a problem that isn't so much a 'problem' as 'the whole point of > cascading stylesheets'. --one point of cascading stylesheets is to ensure site-uniformity and styling flexibility with minimum effort and redundancy. Which is awesome, where you have control over everything. but a 3rd-party widget was not designed to work with your site css, and your site was not designed to work with that widget. if you're designing a custom widget from scratch in concert with your site, then tightly- integrating it with your site css makes more sense. but it makes less sense, to me, to devote frustrating hours to making a 3rd-party widget css to cooperate with your site css, when a simple rule does the trick. choosing the path of greatest effort seems to me to defeat one of the benefits of css-- to reduce effort. besides, as ricardo pointed out, !important does not eliminate all cascading-- undeclared elements will still get cascaded into the widget. For example, my superfish menu still inherits the font-family and font-size from my site-css, which is great--i'm getting the benefit of desirable cascade, while eliminating the undesirable cascades with !important. !important does not 'break' css-- it's part of the css language, intended to be used where appropriate.