In Mozilla Firefox, I want to create userContent.css which overrides the CSS of a site.

Where should I create the file (Windows 7)?


2 Answers 2

  1. Open Firefox and press Alt to show the top menu, then click on HelpTroubleshooting Information

  2. Click the Open Folder button beside the Profile Folder entry

  3. Create a folder named chrome in the directory that opens

  4. In the chrome folder, create a CSS file with the name userContent.css

  5. Copy the following code to userContent.css, replacing "example.com" with the website you want to modify and your own custom CSS. The !important is important.

    @-moz-document domain(example.com) {
        img { opacity: 0.05 !important; }
  6. Open another tab in Firefox, go to about:config, and set toolkit.legacyUserProfileCustomizations.stylesheets preference to true.

  7. Restart Firefox.

  • 9
    A small update / modification for step 1; the Troubleshooting Information opens up a link about:support and in my Firefox (v20 nightly build on Ubuntu) it has an entry named "Profile directory" with a button "Open Directory" which opens up the profile directory /home/tripleee/.mozilla/firefox/asdf1234.default/ in Nautilus.
    – tripleee
    Jan 3, 2013 at 10:38
  • 9
    You can remove @-moz-document domain("...") to apply the style to every pages.
    – Nicolas
    May 30, 2013 at 8:26
  • 5
    One small note, make sure that the folder you create is named, "chrome", with a lowercase 'c', otherwise it will not work on Linux. Dec 22, 2016 at 14:04
  • 18
    It it is necessary to restart Firefox for it to take effect. Jul 18, 2018 at 8:32
  • 41
    Starting with Firefox 69, you need to set the toolkit.legacyUserProfileCustomizations.stylesheets preference to true due to bugzilla.mozilla.org/show_bug.cgi?id=1541233
    – ThomasR
    Sep 18, 2019 at 12:44

There was an old extension called ChromEdit, which added a simple button to easily open user CSS for editing.

This was apparently compromised or withdrawn. Stylish was an alternative, but similarly this now appears to be defunct.

At the moment you just have to remember where the file is supposed to go.

  • 17
    Based on recent reviews, Stylish should probably be avoided.
    – KlaymenDK
    May 31, 2017 at 8:59
  • 2
    An extension is not the same as an actual user stylesheet. That's why Chrome is worthless garbage now.
    – Synetech
    Jul 9, 2017 at 23:02
  • 2
    @Synetech what are you talking about? This extension adds a button to open the stylesheet for editing.
    – OrangeDog
    Jul 9, 2017 at 23:08
  • 2
    Stylish didn't work for me. When I searched for help I found a forum topic in which a user said most users of Stylish have moved to Stylus because of better user support and more continual updates. Stylus is a fork of Stylish. Stylus worked for me without the need to restart Firefox. Usage of the plug-in is simple - navigate to the page you want to style, click the app icon at top-right of your browser, choose whether you want to apply styles to the current URL only or whole domain and write your styles. When you visit again, the icon shows number of styles being applied by the plugin. Oct 3, 2018 at 23:14
  • 2
    @DmitryAlexandrov I have no idea about Stylish. My original answer was about ChromEdit, but years ago someone changed it.
    – OrangeDog
    Jan 26, 2019 at 15:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .