How to inject CSS into webpage through Chrome extension?

You can have to add an extra line in your manifest file:

"content_scripts": [
    {
      "matches": ["http://test-website.com/*"], 
      "js": ["js/content-script.js"],
      "css" : ["yourcss.css"]
    }
],

The CSS file as defined in "css": ["..."]will be added to every page which matches the location as mentioned in matches.

If you’re developing a Chrome extension, make sure that you have a look at these pages:

  1. Developer’s guide

Leave a Comment