[英]css @font-face in ubuntu doesn't work
I developed the web-page under Windows. 我在Windows下开发了该网页。 It has such folders:
它具有以下文件夹:
wwwroot
wwwroot/css
wwwroot/fonts
and files 和文件
wwwroot/css/main.css
wwwroot/fonts/fontaaa.otf
main.css file has such a code: main.css文件具有以下代码:
@font-face
{
font-family : 'fontaaa';
src : url("../fonts/fontaaa.otf");
}
and it sees the font under Windows on my localhost. 它会在我的本地主机上的Windows下看到字体。 Everything is perfect, so I uploaded my project to the linux server.
一切都很完美,所以我将项目上传到linux服务器。 Everything works fine (the page loads, styles are OK), but the font
fontaaa.otf
is not displayed . 一切正常(页面加载,样式都可以),但未显示字体
fontaaa.otf
。 What is the problem? 问题是什么? Spent a lot of time to figure out.
花了很多时间弄清楚。
PS I've never used @font-face
before. PS我以前从未使用过
@font-face
。
PSS the font was downloaded from Internet (was not in the Windows fonts folder). PSS字体是从Internet下载的(不在Windows字体文件夹中)。
Font face is declared like this : 像这样声明字体:
@font-face {
font-family: 'Font name';
font-style: normal;
font-weight: 400;
src: local('Font name'), local('Font name-Regular'), url(fontname.woff) format('woff');
}
And to apply these fonts you've to do like this : 要应用这些字体,您必须这样做:
<style>
h1 {
font-family: 'Font Name', Arial/* Just in case if your web fonts didn't load */;
}
</style>
<h1>this will be font-face fonts</h1>
Tried all answers, no luck, but the problem was found. 尝试了所有答案,没有运气,但是发现了问题。 It was the permission for the fonts folder.
这是字体文件夹的权限。 Thank you everybody.
谢谢大家。
try: 尝试:
@font-face
{
font-family : 'fontaaa';
src : url("../fonts/fontaaa.otf");
}
p, html, body {
font-family:fontaaa;
src: url('../fonts/fontaaa.otf');
}
@font-face {
font-family: 'Font name';
font-style: normal;
font-weight: 400;
src: local('Font name'), local('Font name-Regular'), url(fontname.woff) format('woff');
}
that worked for me (you can put another tag instead of the p) 这对我有用(您可以放置另一个标签而不是p)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.