如何用@font-face替换由system-ui指定的系统默认字体?
替换system-ui指定的系统字体(Windows下的Segoe UI)
比如某网页使用如下CSS代码:
font-family: 'Segoe UI', sans-serif;
我是网页使用者而非开发者,不想用Segoe UI字体时,可以通过Stylus等扩展注入@font-face代码,将其替换为本地字体:
@font-face {font-family: Segoe UI; src: local("my own font");}
但如果网页并未直接指定Segoe UI,而是用system-ui作为字体族(Windows系统下system-ui对应的默认字体就是Segoe UI),比如:
font-family: system-ui, sans-serif;
这时下面两种写法都无法生效:
- 第一种无效写法:
@font-face {font-family: system-ui; src: local("my own font");}
- 第二种无效写法:
@font-face {font-family: Segoe UI; src: local("my own font");}
内容的提问来源于stack exchange,提问作者Zhang Wei
相关产品推荐
相关产品推荐

