Change default CSS of Google Chrome

46

12

I would like to be able to change the default CSS used by chrome, such as removing the underlines for links, etc. However, I cannot find the default CSS file used by Chrome. Does anyone know where it is?

George IV

Posted 2009-10-08T19:36:51.957

Reputation: 1 121

For simple way to modify css using your own very simple extension see: https://stackoverflow.com/questions/21948850/google-chrome-custom-css-webkit-scrollbar-no-longer-works

– User – 2018-03-11T03:06:34.980

3If you are a developer, I recommend not to do this since it changes the default value of css. – Dzung Nguyen – 2012-06-01T14:38:16.990

Answers

34

(Update 2014) Since support of user stylesheets was recently removed from Google Chrome, the only option for this moment is to use extensions (like Stylus *1), but these will behave differently (see below).

The most relevant request for re-introducing true user stylesheets in Google Chrome is Issue 347016: Support user stylesheets.

Per specification, "true user stylesheet" rule has lower origin specificity in cascade than author rule, but !important user stylesheet rules have higher origin specificity than !important author rule, regardless of its selector specificity.

Extensions mimicking user style-sheets in Chrome simply injects (hopefully) last style element into page, what have some consequences:

  • such style is at "author level" in the cascade, so you must make sure your !important rule has higher specificity than one you want to override
  • "your" injected style is exposed to page scripts, so they can easily delete it at will.

*1 Original extension, Stylish, is currently (2017) in state of erratic development by a new mainetainer, so I'd advise to avoid it and use alternative like aforementioned Stylus.


(Following original answer is now obsolete.)

Afaik it is not possible to tweak the UA css itself, but you can make a global userstyle: start Chrome once with --enable-user-stylesheet. This will create <user-data-dir>/<profile>/User StyleSheet/Custom.css which you can use (changes are propagated immediately). http://code.google.com/p/chromium/issues/detail?id=2393

myf

Posted 2009-10-08T19:36:51.957

Reputation: 451

yeah doesn't seem to be supported anymore (tried on chrome 73 and 76 (canary)) (Custom.css and the User Stylesheets don't exist anymore) – localhostdotdev – 2019-05-06T04:36:24.450

1

ockquote>

= Chrome 65: Dev Tools supports local overrides. https://developers.google.com/web/updates/2018/01/devtools#overrides

– varontron – 2019-12-29T17:22:53.630

8

You can have a look at this discussion : Issue 2393: Support user stylesheet

At the very end they mention that the --enable-user-stylesheet parameter when starting Chrome would enable custom stylesheets..

Gabriele Petrioli

Posted 2009-10-08T19:36:51.957

Reputation: 212

4

The only solution I can think of it to use a Greasemonkey script that adds a style entry to every html page which turns off the underlines for links. Something like:

<style> a {text-decoration:none} </style>

This article can apparently get you started:
HOW TO: Install Google Chrome Greasemonkey Scripts (Windows Only)

harrymc

Posted 2009-10-08T19:36:51.957

Reputation: 306 093

4I find it funny that I can't directly modify the CSS. Firefox has userChrome.css and userContent.css, which make modifying look and feel insanely simple. – George IV – 2009-10-08T20:17:40.563

@harrymc - I switched your <style> code from the blockquote to the code so that you don't have to worry about the "extra spaces" – Jared Harley – 2009-12-23T02:37:50.113

2

If you are interested in customizing particular web sites, you can use greasemonkey style user scripts.

Kevin Panko

Posted 2009-10-08T19:36:51.957

Reputation: 6 339

0

There is an issue when use Stylish as user-style injector:
user priority level without !important is higher than author priority level without !important

So I write a user-script as injector:
https://github.com/zcyzcy88/SelfColle/blob/master/StyleInject.user.js

principle:
Inject style at document.head.prependChild(), before webpage author's style, has a lower priority, to avoid user-style overlay.

Sista Fiolen

Posted 2009-10-08T19:36:51.957

Reputation: 11

Hi, and welcome to SuperUser.com. Would you be able to go more in-depth on what your script does exactly? – Service Manager – 2017-03-17T14:37:04.993

Inject style at document.head.prependChild(), to avoid userstyle overlay. – Sista Fiolen – 2017-03-18T07:07:21.473

If you can edit your answer, to go into more detail about what each part of your script does, would be helpful. – Service Manager – 2017-03-20T14:43:25.810

0

In 2018, Chrome >= 68.0.3440.106 (and probably much earlier)

I already had the extension Resource Override for various development uses, so I now use that to add my own stylesheet to fix some bad style choices in JIRA (and to hide more ads - heh heh). The option I use is "Inject File" and it works very well. I've not tried regexing the 'url' setting to make it only work on particular sites, but my css selectors are specific enough that I can just leave the url as '*'

eon

Posted 2009-10-08T19:36:51.957

Reputation: 111

0

I came across this question when looking for a solution on how to provide a stylesheet for unstyled pages. None of the solutions above helped me much an still as of 09/2018 chrome does not support the previously removed custom stylesheet function.

The solution I came up with and that works like charm for my use case is achieved by using this chrome addon with a custom js script that inserts my custom css to page's header if it does not have any stylesheets. It won't work on a page that has any stylesheet linked but for my use case it is sufficient.

Here is the JS script I'm using:

window.addEventListener("load", function(event) {
    console.log("All resources finished loading!");
    console.log(document.styleSheets); 
    if (document.styleSheets.length > 0) {
        return;
    }

    var css = `
    /*Your CSS goes here*/
    `;
    var style = document.createElement('style');
    style.type = 'text/css';
    style.appendChild(document.createTextNode(css));
    document.head.appendChild(style);
  });

Maroš Beťko

Posted 2009-10-08T19:36:51.957

Reputation: 101

0

Since Chrome 65, local overrides are supported. See the feature description in the release notes.

varontron

Posted 2009-10-08T19:36:51.957

Reputation: 109

1It requires opened DevTools. – AlexP11223 – 2020-01-24T06:16:25.243

0

You can change chromes css ui style. Just remember if you change it, some effects like Example: #footer {color:#5F5F5F !important;} will change on every site that uses #footer. You been warned. Custom.css changes almost everything in chromes browsers

Windows XP Google Chrome:

C:\Documents and Settings\%USERNAME%\Local Settings\Application Data\Google\Chrome\User Data\Default

Chromium:

C:\Documents and Settings\%USERNAME%\Local Settings\Application Data\Chromium\User Data\Default\User StyleSheets

Windows 7 or Vista (help in help section) Google Chrome:

C:\Users\%USERNAME%\AppData\Local\Google\Chrome\User Data\Default\User StyleSheets

Chromium:

C:\Users\%USERNAME%\AppData\Local\Chromium\User Data\Default\User StyleSheets

Mac OS X Google Chrome:

~/Library/Application Support/Google/Chrome/Default/User StyleSheets

Chromium:

~/Library/Application Support/Chromium/Default/User StyleSheets

Linux Google Chrome:

~/.config/google-chrome/Default/User StyleSheets

Chromium:

~/.config/chromium/Default

Chrome OS

/home/chronos/

Want proof check out my theme for the program editor http://userstyles.org/styles/95226/chrome-userstyles-editor-hacker-version-cyberat

Feel free to check me out, i create UI style sheets or random sites like facebook google.etc, and make them black & red.

cyberationmicro.com

Posted 2009-10-08T19:36:51.957

Reputation: 9

4That won’t work because Chrome 33 dropped support for user styles. – Synetech – 2014-03-27T04:51:59.080

-1

Quidam

Posted 2009-10-08T19:36:51.957

Reputation: 214

Please quote the essential parts of the answer from the reference link(s), as the answer can become invalid if the linked page(s) change. – DavidPostill – 2016-12-19T23:53:12.773