Font Family Open Sans not being used

匿名 (未验证) 提交于 2019-12-03 02:50:02

问题:

I am using Google's Open Sans Font in my application.

I have defined the stylesheet as instructed:

<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,700'  rel='stylesheet' type='text/css'> 

I then used it on the body selector as:

body {     font-family: 'Open Sans', sans-serif; } 

I have not defined font family anywhere else. I assume that since I have defined it at the parent, the child elements will automatically inherit it.

However, if I open up the inspector for say an anchor tag in my application and see the computed styles for that tag, I find that (Chrome Latest) the "Rendered Font" says "Times New Roman 18 glyphs" - Is this correct? I was expecting it to say "Open Sans" - Is the Open Sans font not being applied?

回答1:

Check out the codepen link. Its working fine for me !

.open-sans-font{   font-family: 'Open Sans', sans-serif; }
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,700" rel="stylesheet">  <div class="open-sans-font">    Stackoverflow rocks !!! </div>


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!