ricardo:

"what does this have to do with jQuery?"

     --this topic is on the jquery forum, because problems with a
jQuery component, Superfish,  caused me to devise this method. The
superfish support page directed me to this forum for support. the
author of the plugin has not spoken up yet. (I imagine this technique
might be useful for other jQuery candy.)
"Support for the Superfish plugin is available through the jQuery
Mailing List."
http://users.tpg.com.au/j_birch/plugins/superfish/#download

"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"

     --i believe that's incorrect, if by "container" you mean unique
classes and id's. as i describe above, unique id's will NOT protect
the component's style from the main site-css, if the site-css cascades
into the candy. Which is exactly what what messed up my superfish
menu.

"writing styles in-line (if it's not meant to be altered). If this has
not been done it is indeed badly written code."

     --i don't agree. one of the principals of best-practice web-
styling is to NOT use inline styles, but to separate formatting out to
a css file. that way, the web developer can tweak the formatting
without touching the html structure.

"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"

     --i dont agree. the mess is what you have without !important. it
instantly clears up that mess, because then you know exactly which css
is controlling the candy-- the one with !important. override the
cascading is exactly the benefit of using !important. The site-css was
not designed to be compatible with your 3rd-party candy.

i think the reason !important is seldom used, is because it's little-
known, and because it's usually described as a way to resolve
conflicts between web-page and browser-css (aka "author" vs "user").

"prepending the unique ID to every style is much better."
     --Superfish does indeed use a unique ID. as Klaus points out,
that does not insulate Superfish from the site-css.

for me, the proof is in the pudding. My silverfish displayed all wrong
without !important. It displays beautifully WITH !important. That's
all the proof i need!


klaus:

"a 3rd party widget...should...use...important declarations.
Nevertheless there is no guarantee that the site's CSS will not
override styles."
--why? unless the site css ALSO uses !important, how else could it
override the candy-css?

Reply via email to