CSGO
V2EX  ›  问与答

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

  •  
  •   CSGO · Sep 5, 2022 · 923 views
    This topic created in 1354 days ago, the information mentioned may be changed or developed.
    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 ,这是怎么回事呢?
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   956 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 245ms · UTC 20:09 · PVG 04:09 · LAX 13:09 · JFK 16:09
    ♥ Do have faith in what you're doing.