问题
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