如何包含字体@ font-face

时间:2017-07-20 08:36:18

标签: wordpress font-face

我已经下载了一个字体libertaion_sans,它保存在Wordpress主题内的字体文件夹下,如\fonts\liberation_sans

我在Youtube上看到了很多视频,在StackOverflow上看到了一些链接,但我没有正确地包含它们。enter image description here

如果我没有错,我们必须在实际使用之前在style.css中定义这些字体:

font-family

有人可以帮助我。

目前,

我有兴趣使用它们

font-family: LiberationSans-Bold;

1 个答案:

答案 0 :(得分:1)

像这样的东西=> 在您的css文件中

@font-face {
    font-family: 'YourFontName'; /*a name to be used later*/
    src: url('/fonts/font.ttf'); /*URL to font*/
}

在任何css规则中使用font-family: 'YourFontName'
干杯!

PD:分别创建每个。

@font-face {
    font-family: 'LS-bold'; /*a name to be used later*/
    src: url('/fonts/ls-bold.ttf'); /*URL to font*/
}
@font-face {
    font-family: 'LS-Regular'; /*a name to be used later*/
    src: url('/fonts/ls-regular.ttf'); /*URL to font*/
}

<强> ..等等...
如果你想使用粗体字体,你必须使用font-family:'LS-bold' 理解?

相关问题