5

How can I customize my Firefox, so if a page has no style-definitions firefox will use a local stylesheet, that I can define myself?

I found this addon: Context Style Switcher, that can remove the stylesheet from a page, but that does look realy ugly.

It would be perfect, if I could define a per-site CSS, that is used every time I visit a page.

rubo77
  • 5,218

2 Answers2

4

You can set the various options (color, fontsize, font family) inside about:config to a certain degree. (type about:config as an address and open it)

some examples @ Firefox 62

browser.display.foreground_color: sets the text color
browser.display.background_color: sets the background color of a page

For further settings you can type in color or font or size inside the searchbar.

DarkTrick
  • 171
2

Use a userscript

...to automatically run user-defined JS. To make use of userscripts you have to install a browser extension called "userscript manager", which are available for all modern browsers. Learn more about userscripts.

Here is an sample JS that checks if <head> element contains any <style> or <link rel="stylesheet">. If no, then user-defined CSS is inserted:

const head = document.getElementsByTagName('head')[0];
if(head.querySelector('style, link[rel~=stylesheet]') === null) {
    head.insertAdjacentHTML(
        'beforeend',
        '<link rel="stylesheet" href="https://unpkg.com/spcss" />'
    );
}

Replace the "https://unpkg.com/spcss" with a URL of your CSS. There are other approaches to load CSS file using JS or you can insert a <style> tag to define styles directly.

I'm not sure if it's possible to load a local CSS file from http:// page or access local filesystem from a userscript :( but the script itself is a local file.

I've just published example above as a ready-to-use usercript: https://greasyfork.org/en/scripts/482860-default-css.

belkka
  • 121