0

In attempting to learn more about chrome extensions, I am trying to create a few buttons to appear on a page. I originally used the setAttribute("style", "") for them but I wanted to add something for a hover effect. So I created a style sheet and have been trying to inject it so that the styles will be picked up by the buttons. I have tried this in a myriad of ways:

First thing I saw was to put it into the content_scripts in the manifest.

Second I tried to add it to the web_accessible_resources and to append a link to the stylesheet to the webpage (from this answer Injecting custom CSS with content.js [CHROME EXTENSION] is not working)

Third I tried to utilize chrome.scripting.injectCSS but still no luck.

I've also tried different combinations of those but still nothing. The buttons I created are not taking in the css that I set for them.

Just for clarity, I set a class on the buttons and the css is selecting that class. All are labeled as !important as I saw that somewhere as well. I'm not quite sure what anyone would need to see to explain what it is I need to do in order to get these buttons to recognize the css that is being set for them in that file. Any help would be great and let me know if you need any snippets of my code

Tapialj
  • 333
  • 2
  • 3
  • 11
  • 1
    See examples in [How to really isolate stylesheets in the Google Chrome extension?](https://stackoverflow.com/a/25100953) – wOxxOm Apr 07 '23 at 19:09
  • Would inline styles for the buttons work? When you inject them, you can add style properties – BestCoderBoy Apr 07 '23 at 19:09

0 Answers0