I recently built a widget that, when used in the production site, resulted very different because global styles set on elements like section
, or header
were affecting it.
As a result, I had to add specific CSS styles to the widget that had the purpose of overriding the styles set by the site, for example:
header {
height: auto;
max-height: none;
background: transparent;
font-size: inherit;
}
How can I avoid this in the future?
I've been looking into the Polymer Project, which could in theory allow me to use custom web components to define elements that are completely off the defined rules.
Another alternative is using:
.myWidget > * { all: unset; }
But it's only supported on Firefox 27.
How should I go about doing this?