I have developed a JavaScript Widget for a client, and I tested it on all my sites and it works and looks perfect.
My client dropped it into his blog, and the styles don’t show quite as they should.
Although I’m not sure which of his styles are conflicting yet, I know its some of his styles interfering because I removed his styles from the blog page momentarily and the widget displayed correctly.
Is there anyway I can override the other styles? I don’t know who might use the widget in the future so I need to make sure this wont happen on another website.
Sounds like you’re getting tagged by specificity problems - even though you’re specifying styles on an specific element using the id specifier, if there are other styles which have a higher specificity count (say two classes or a tag and a class), those will take precedence. I know it doesn’t make sense, especially if you’re a programmer, but that’s the way it works.
I asked a similar question last year, and as you’ll see in the thread, it took a while for me to accept it…I still don’t understand why, but I just go with it…
In this case, it’s probabably best to pull out the CSS sledgehammer and just add !important to any declaration that’s likely to meet with conflict. E.g.