简体   繁体   English

在 css 中应用自定义字体不起作用?

[英]Applying custom font in css is not working?

I am trying to use a custom font for the headings on my site but I cannot get it to work.我正在尝试为我网站上的标题使用自定义字体,但我无法让它工作。 It is just displaying as default Times New Roman or something no matter what I try.无论我尝试什么,它都只是显示为默认的 Times New Roman 或其他东西。 Does anyone have any advice about what I can do to get this font to show?有没有人对我可以做些什么来显示这种字体有什么建议?

<style>

@font-face {
font-family:"volcano";
src: url("/wp-content/themes/wp-bootstrap-4/assets/fonts/Volcano-King.ttf") format ("truetype"),
     url("/wp-content/themes/wp-bootstrap-4/assets/fonts/Volcano-King.woff") format ("woff");
}

h1 {
font-family: "volcano";
}

</style>

Looks like there's a missing :看起来缺少一个

Try this尝试这个

<style>

@font-face {
font-family:"volcano";
src: url("/wp-content/themes/wp-bootstrap-4/assets/fonts/Volcano-King.ttf" format ("truetype"),
     url("/wp-content/themes/wp-bootstrap-4/assets/fonts/Volcano-King.woff" format ("woff");
}

h1 {
font-family: "volcano";
}

</style>
h1 {
font-family: "volcano";
}

add a colon between property-name and property-value在属性名和属性值之间添加一个冒号

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM