6

I know about user agent stylesheet but I am seeing user stylesheet only on some specific sites in the Styles section of the developer tools, even though there is no Custom.css in my User Stylesheets in my Chrome Profile.

Rob W
  • 341,306
  • 83
  • 791
  • 678
eldos
  • 3,132
  • 3
  • 29
  • 32
  • Browsers are supposed to support user style sheets (CSS 2.2, 3.2 UA Conformance, "UAs must allow users to specify a file that contains the user style sheet. UAs that run on devices without any means of writing or specifying files are exempted from this requirement.", https://www.w3.org/TR/CSS22/conform.html#conformance) – However, Google Chrome intentionally broke this. The extension API still exists that allows creating user style sheet via extensions which is computationally the same thing but harder to use. See https://bugs.chromium.org/p/chromium/issues/detail?id=347016 for details. – Mikko Rantalainen Dec 13 '22 at 07:47

1 Answers1

5

These "User stylesheet"s are added by Chrome extensions, either declared in a manifest file, or using chrome.tabs.insertCSS.

Styles on the web page always take precedence over the user stylesheet, unless the rule set in the (extension's) user stylesheet has a higher specifity.

If you want to know which extension is responsible for these stylesheets, just disable the extensions one by one until the stylesheet goes away. After disabling an extension, select a different element in the inspector, then select the original element to refresh the view, you don't have to reload the page.

Rob W
  • 341,306
  • 83
  • 791
  • 678
  • Is there any simpler method to identify the extension causing this? – eldos Jun 28 '14 at 12:09
  • 1
    @eldos Search in the Extensions directory of your [user data directory](http://www.chromium.org/user-experience/user-data-directory) for the offending extension. In most cases, the style sheet is declared in a file called `manifest.json` (e.g. `"content_scripts": [{ "css": ["style.css"], ...`). – Rob W Jun 28 '14 at 12:20