I have a jQuery plugin that is going to dynamically render a decent amount of HTML to the page. I want consumers of the plugin to be able to use it as is and for it to look the same no matter what CSS styles they have in place.
Hence I need a "scoped" CSS reset - i.e. the ability to say anything within my plugins div should not be affected by the owners CSS.
Now obviously I can reset all the HTML elements that I use within this scope but it doesn't seem very elegant. Anyone else go any ways they handle this?
You could put all the styles inline in the HTML you inject into the DOM via your plugin. That's still no guarantee, as users could over-ride it with their own JS if they desired too.
If it's more for a convenience, then you could wrap all of your HTML in an ID, then reset everything within:
Again, no guarantee of anything. But should work by default.