treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Prevent styling of DOM elements inserted by Chrome extension

  • Hello,

    I created a browser extension that inserts DOM elements directly into a page, and I'd like to prevent them from being styled by any inherited CSS already in the page. At the moment, I append my a css call to the head to bring in my own styles. So far my plan has been to use obscure class/id names and create very specific rules. In some cases I've had to use !important. I feel like I'm throwing throwing my morals out the door!

    Any thoughts on how I could efficiently prevent inherited styling, and yet allow the browser to render my code efficiently?

    Any thoughts on how I could use an iframe to do this?

    Thanks!