浏览器中的站点特定字体覆盖?

R.J*_*.J. 5 browser fonts

是否可以让 firefox 浏览器(或 chrome)在特定网页上使用字体覆盖?

具体来说,我试图寻找一种方法让所有维基百科页面都以无衬线字体而不是无衬线字体显示。

use*_*686 7

如果您想专门覆盖维基百科中的字体,请编辑Special:MyPage/vector.css(对于默认的 Vector 皮肤):

例子:

#bodyContent {
    font-family: serif;
}
Run Code Online (Sandbox Code Playgroud)

这存储在您的维基百科帐户中,适用于所有浏览器。如果您使用不同的皮肤(主题),请更改.css名称(例如monobook.css)。

(我假设您打算写"display in serif 而不是 sans",因为 "sans" 和 "sans-serif" 是同一回事。)

特定字体的示例: font-family: Garamond, "Times New Roman", serif;


要获得更通用的解决方案,请安装适用于FirefoxChromeStylish扩展程序。(在 Firefox 中,您可以手动编辑。)这样您就可以为特定站点或所有内容设置覆盖。userContent.css

维基百科的例子:

@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document url-prefix(http://en.wikipedia.org/) {
    #bodyContent {
        font-family: serif;
    }
}
Run Code Online (Sandbox Code Playgroud)

它与上面大致相同,但添加了@namespace, 并包裹在一个@-moz-document块中。