如何编辑 Firefox 阅读器视图的 CSS/样式

Muh*_*med 10 css firefox styling firefox-reader-view

我想在 Firefox 阅读器视图样式中包含我选择的字体。

请告诉我 Firefox 是使用本地 CSS 文件进行样式设置还是位于其他地方?

此外,Firefox 用于阅读器视图的 CSS 文件名是什么,我如何编辑它。

提前致谢!

Pat*_*ner 8

cd /home/$USER/.mozilla/firefox/<PROFILE_FOLDER>/chrome/userContent.css 仅当您已经进行设置时,您才能在路径下找到“Firefox 阅读器视图”的 CSS 文件 :

  1. 在您的 Firefox URL-search-bar 中输入:about:support
  2. 通过选择打开您的配置文件文件夹Show Folder
  3. 在您的配置文件文件夹中创建一个名为的新文件chrome.
  4. 导航到chrome并创建一个名为的新纯文本文件userContent.css
  5. userContent.css根据您的 CSS 首选项进行编辑。
  6. 在新的 Firefox 配置文件中,从 Firefox 69 开始,您还必须启用toolkit.legacyUserProfileCustomizations.stylesheetsin about:config,参见。Firefox 69:userChrome.css 和 userContent.css 默认禁用

就我而言,它看起来如下所示:

cd /home/$USER/.mozilla/firefox/<PROFILE_FOLDER>/
mkdir chrome
cd ./chrome
touch userContent.css
Run Code Online (Sandbox Code Playgroud)

CSS 示例:

@-moz-document url-prefix("about:reader") {
  body.dark {
    color: salmon !important;
    background-color: black !important;
  }
  body.light {
    color: #222 !important;
    background-color: #EEE !important;
  }
  body.sepia {
    color: #5B4636 !important;
    background-color: #F4ECD8 !important;
  }

  body.serif {
    font-family: serif !important;
  }
  body.sans-serif {
    font-family: sans-serif !important;
  }
}
Run Code Online (Sandbox Code Playgroud)

有关进一步说明,请参阅此参考资料

  • 在新的 Firefox 配置文件中,从 Firefox 69 开始,您还必须在 _about:config,_ cf 中启用“toolkit.legacyUserProfileCustomizations.stylesheets”。[Firefox 69:默认禁用 userChrome.css 和 userContent.css](https://www.ghacks.net/2019/05/24/firefox-69-userchrome-css-and-usercontent-css-disabled-by-默认/)。 (4认同)
  • 仅仅改变字体就显得很多了。为什么 Mozilla 如此害怕允许用户定制他们的阅读体验? (3认同)