字体文件在本地环境中工作,但实时站点我得到 404(未找到)



我在WordPress中使用了一些字体我像这样导入它们

@font-face {
font-family: "Neutra";
src: url("/wp-content/themes/Sunterra/resources/fonts/Neutra-Text-Bold.otf");
}

这在我的本地开发环境中工作,但在实时服务器上,我得到404 (Not Found)

服务器没有找到字体,原因很可能是路径或权限问题。

尝试使用完整的url进行测试。如果这不起作用,你应该试着找出字体的实际位置,以及它是否存在于服务器上。

@font-face {
font-family: "Neutra";
src: url("/wp-content/themes/Sunterra/resources/fonts/Neutra-Text-Bold.otf");
}
I think your font path was wrong. make sure your css file was link correctly something like that 
@font-face {
font-family: 'iconfont';
src:
url('../fonts/iconfont.ttf?ukrc8w') format('truetype'),
url('../fonts/iconfont.woff?ukrc8w') format('woff'),
url('../fonts/iconfont.svg?ukrc8w#iconfont') format('svg');
font-weight: normal;
font-style: normal;
}
font file need to link with your css file
File stracture 
-root
-css
-fonts.css
-fonts
-iconfont.ttf

最新更新