Can't get @fontface CSS to work in WordPress

时光总嘲笑我的痴心妄想 提交于 2021-02-11 12:33:52

问题


I'm pretty sure this is what I've always done in the past, but I can't get it to work this time. The folder AFONTNAME is in the fonts folder within the active theme folder:

@font-face {
  font-family: "A Font Name";
  src: url("/fonts/AFONTNAME/AFONTNAME.ttf") format("ttf"),
       url("/fonts/AFONTNAME/AFONTNAME.woff") format("woff"),
       url("/fonts/AFONTNAME/AFONTNAME.svg") format("svg");

}

.specialfont { font-family: "A Font Name" }

Have tried using the full path to the fonts folder, with and without font-weights and with and without the SVG font. No matter what I do, targeted content only displays in Times Roman. Since this is not the theme's default font it leads me to believe the path is correct, but something else in incorrect.

来源:https://stackoverflow.com/questions/65373004/cant-get-fontface-css-to-work-in-wordpress

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