我想要我的字体粗细像这个标题 website h2元素
我正在使用下面的 css,我尝试了所有方法,但我网站上 h2 元素的字体粗细仍然是粗体,那么这个
CSS:
h2 {
color: #2598ea;
font: normal normal 300 38px / 51px "Open Sans", Calibri, Helvetica, Arial, Verdana, sans- serif;
text-transform: none;
}
我真的不知道这段代码有什么问题
最佳答案
回到基本问题,我认为这才是问题的关键。您是否从谷歌字体加载了正确的字体粗细?当您从其中选择您喜欢的字体时,请确保选择适当的字体粗细。
如果不是,请确保使用以下代码将其放入 html head 中。
检查我的代码笔以了解如何执行此操作。
代码笔:http://codepen.io/Travo100/pen/rdLmG
<!-- font-weight of 300 included here -->
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300' rel='stylesheet' type='text/css'>
<h2> Welcome to Ardent Engineers </h2>
h2{
color: #2598ea;
/*font weight of 300 here*/
font: normal normal 300 38px / 44px "Open Sans", Helvetica, Arial, Verdana, sans-serif;
text-transform: none;
}
关于html - 将 font-weight 设置为 100 后,文本字体仍然是粗体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23821318/