自定义网络字体麻烦

时间:2014-12-19 17:47:35

标签: html css fonts font-face

我希望我能在这里得到一些帮助,真的很感激。我正在尝试使用自定义字体...但由于某种原因它不起作用...这是我的代码到目前为止:

<style>
@font-face {
font-family: "coolest";
src: url('http://domain.com/fonts/lalo.ttf') format('truetype');
}

h1 {
font: 'coolest';

}
</style>

<h1>HELLO</h1>

1 个答案:

答案 0 :(得分:0)

假设您正确引用了字体文件,问题在于您没有正确使用font规则。 font速记首先采用强制字体大小,然后采用font-family。试试这个:

font-family: 'coolest';

或:

font: 12px 'coolest';

参考:https://developer.mozilla.org/en-US/docs/Web/CSS/font

示例:http://codepen.io/Godwin/pen/zxBLWW/

相关问题