Removes from a page CSS which was previously injected by a call to tabs.insertCSS().


  tabId,           // optional integer
  details,         // extensionTypes.InjectDetails
  callback         // optional function


tabId Optional
integer. The ID of the tab from which to remove the CSS. Defaults to the active tab of the current window.
extensionTypes.InjectDetails. An object describing the CSS to remove from the page. It contains the following properties:
boolean. If true, the code will be removed from all frames of the current page. If it is false, code is only removed from the top frame. Defaults to false.
string. CSS to remove, as a text string. This must exactly match a CSS string previously inserted into the page using tabs.insertCSS().
string. Path to a file containing the CSS to remove. This must exactly match a CSS file previously inserted into the page using tabs.insertCSS().
integer. The frame from which to remove the CSS. Defaults to 0 (the top-level frame).
boolean. If true, the CSS will be removed from embedded "about:blank" and "about:srcdoc" frames if your add-on has access to their parent document. Defaults to false.
callback Optional
function. Called, with no arguments, when the CSS has been removed from the page.

Browser compatibility

Chrome Edge Firefox Firefox for Android Opera
Basic Support No No 49.0 No No

Compatibility notes


  • 'matchAboutBlank' is not supported.


Remove CSS found in a string

This example removes the CSS found in a string from the currently active tab.

var css = "body { border: 20px dotted pink; }";

chrome.tabs.removeCSS({code: css});

Remove CSS found in an extension-packaged file

This example removes from the active tab CSS loaded from a file.

chrome.tabs.removeCSS({file: "/path/to/content-style.css"});

Remove CSS from a specific tab and its sub-frames

This more intricate call to tabs.removeCSS() removes CSS loaded from a bundled file from the tab whose ID is 5. In addition, the CSS is removed from all frames within the document.

When all of the CSS has been removed, the provided onExecuted() function is called.

function onExecuted() {

  5, {
  file: "/path/to/content-style.css",
  allFrames: true
}, onExecuted);


This API is based on Chromium's chrome.tabs API. This documentation is derived from tabs.json in the Chromium code.

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

Document Tags and Contributors

 Contributors to this page: wbamberg, Sheppy
 Last updated by: wbamberg,