无法获取CSS字体
我的CSS文件中有这个,但我仍然无法获取字体。有什么帮助吗?试试看无法获取CSS字体,css,ruby-on-rails,fonts,font-face,Css,Ruby On Rails,Fonts,Font Face,我的CSS文件中有这个,但我仍然无法获取字体。有什么帮助吗?试试看 @font-face { font-family: "Gotham"; src: font_path("gotham-rounded-medium.otf") format("opentype"); } 如果字体文件位于资产目录中,请重试 @font-face { font-family: "Gotham"; src: url("gotham-rounded-medium.otf"); } 您需要指定url,
@font-face {
font-family: "Gotham";
src: font_path("gotham-rounded-medium.otf") format("opentype");
}
如果字体文件位于资产目录中,请重试
@font-face {
font-family: "Gotham";
src: url("gotham-rounded-medium.otf");
}
您需要指定url,我相信它是字体路径,而不是字体路径 @字体{ 字体系列:高谭; src:urlfont-pathgotham-rounded-medium.otf formatopentype; }
更多信息:有太多可能出错的地方,我们需要更多信息,例如字体文件与html文件的对应位置,以及css相对于html的位置。您在哪里找到font_path变量?它应该是src:urlgotham-rounded-medium.otf formatopentype;
@font-face {
font-family: "Gotham";
src: url('/assets/gotham-rounded-medium.otf') format("opentype");
}