本文介绍了上传到Web服务器时,字体会改变重量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Google字体Open Sans,并且在我的本地计算机的Chrome浏览器中似乎正常显示的时候,当我查看上传到我的网络服务器。



检查服务器本地中的Chrome元素(H2)样式显示:




  • font-family:'Open Sans',sans-serif,Arial;
  • font-weight:600;然而,看着Inspector的'computed'选项卡,并且滚动到'Rendered Fonts',我看到'Open Sans Semibold -55 glyphs'local,'Open Sans Extrabold-55 glyphs'on the server。 解决方案
  • 提供一个字体权重默认在

      .myClass {
    font-family:'Open Sans';
    font-weight:700;
    }


    I'm using the Google font 'Open Sans', and while it seems to be displaying properly on my local machine's Chrome browser, the font is much bolder when I view the same page uploaded to my web server.

    Inspecting the element (an H2) styles in Chrome both locally and on the server, shows:

    • font-family: 'Open Sans', sans-serif, Arial;
    • font-weight: 600;

    However, looking at the 'computed' tab of the Inspector, and scrolling down to 'Rendered Fonts', I see 'Open Sans Semibold—55 glyphs' locally, and 'Open Sans Extrabold—55 glyphs'on the server.

    解决方案

    Provide a font-weight by default as in

    .myClass{
       font-family:'Open Sans';
       font-weight: 700;
    }
    

    这篇关于上传到Web服务器时,字体会改变重量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

    10-24 22:29