【发布时间】:2016-11-26 19:39:04
【问题描述】:
据我所知,在这种情况下,要使用本地存储的自定义字体,您将使用与此类似的字体。
@font-face {
font-family: 'theFontFamily';
src local('the font'),
local('the-font'),
url(path/to/the-font);
}
.fontClass {
font-family: 'theFontFamily', extra_settings;
}
那么在本地使用这个font,你会期望它工作吗?
@font-face {
font-family: 'Pacifico';
src: local('Pacifico Regular'),
local('Pacifico-Regular'),
url(resources/fonts/Pacifico.ttf);
}
.logo-container {
font-family: 'Pacifico', cursive;
}
当我尝试它时,代码会更改字体,而不是更改为所需的字体。看起来像这样。
而如果我使用导入链接 <link href="https://fonts.googleapis.com/css?family=Pacifico" rel="stylesheet">,则只需使用以下代码即可。
.logo-container {
font-family: 'Pacifico', cursive;
}
看起来像这样。
我可能犯了一个简单的错误,如果有人能帮助我解决这个问题,我将不胜感激。
【问题讨论】:
-
你确定你有正确的网址吗?字体在本地看起来仍然不同的原因是因为无法找到
cursive而不是'Pacifico'被加载 -
@Bubblesphere 我相信这是问题所在。现在只需找到正确的网址,因为我应该可以使用它。以及最新版本的谷歌浏览器
标签: html css fonts font-face webfonts