V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
CSGO
V2EX  ›  问与答

html 使用 Google 字体没有加载出来是怎么回事?

  •  
  •   CSGO · 2022-09-05 16:02:49 +08:00 · 469 次点击
    这是一个创建于 619 天前的主题,其中的信息可能已经有所发展或是发生改变。
    html 中引用了 3 个谷歌字体:

    @import url('https://fonts.googleapis.com/css2?family=Lexend:wght@100;200;300;400;500;600;700;800;900&family=Noto+Sans+SC:wght@100;300;400;500;700;900&display=swap');
    /*主字体 font-family: 'Lexend', 'Noto Sans SC', sans-serif, Arial, Helvetica;*/

    @import url('https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,300;0,400;0,500;1,300;1,400;1,500&display=swap');
    /*等宽数字字体 font-family: 'DM Mono', monospace;*/

    * {
    font-family: 'Lexend', 'Noto Sans SC', sans-serif, Arial, Helvetica;
    }

    'Lexend'是个外文字体, 'Noto Sans SC'是个中文字体, 'DM Mono'是个等宽的数字外文字体。
    所以这样的话,是不是页面上会优先使用'Lexend',然后如果页面中出现中文,因为'Lexend'没有中文,就会显示'Noto Sans SC'的中文字体?

    然后正文中,我有数字的话希望使用等宽字体:
    <span style="font-family: 'DM Mono';">12345</span>

    🤔️ 疑问:
    但是观察页面,英文看上去是用上了'Lexend',中文我不清楚到底使用上什么字体,可能是'Noto Sans SC',我不清楚要怎么知道实际用上了什么字体?
    然后是 span 里的数字,明显不是用上的'DM Mono'字体,Google 字体使用的时候它是这样的:style="font-family: 'DM Mono', monospace;,我尝试也这样的话,明显看到它用上了后面的 monospace ,这是怎么回事呢?
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5665 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 07:04 · PVG 15:04 · LAX 00:04 · JFK 03:04
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.