我在我的mac上编码了一个网站,我使用了自定义字体。我用这个font-face规则定义了自定义字体:
@font-face
{
font-family: gnuolane;
src: url('../fonts/gnuolane.otf'),
}
问题是任何浏览器的任何Windows版本都没有加载该字体。在我的Mac上,在Safari / Chrome / FF上工作正常。
当font-face工作正常时,这就是它应该是这样的:
由于
LE: 我从fontsquirrel.com生成了这段代码和所有这些文件。还是行不通。我尝试了'../ fonts / gnuolane ....'和'/ fonts / gnuolane ....'
@font-face {
font-family: 'gnuolane';
src: url('../fonts/gnuolane_rg-webfont.eot');
src: url('../fonts/gnuolane_rg-webfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/gnuolane_rg-webfont.woff') format('woff'),
url('../fonts/gnuolane_rg-webfont.ttf') format('truetype'),
url('../fonts/gnuolane_rg-webfont.svg#gnuolane_rgregular') format('svg');
font-weight: normal;
font-style: normal;
}
仍然没有工作'..
答案 0 :(得分:3)
将所有字体文件(我指的实际字体)移动到与CSS文件相同的文件夹中... 然后使用这个CSS块。告诉我它是否有效。我觉得这是一个路径问题......
@font-face {
font-family: 'gnuolane';
src: url('gnuolane_rg-webfont.eot');
src: url('gnuolane_rg-webfont.eot?#iefix') format('embedded-opentype'),
url('gnuolane_rg-webfont.woff') format('woff'),
url('gnuolane_rg-webfont.ttf') format('truetype'),
url('gnuolane_rg-webfont.svg#gnuolane_rgregular') format('svg');
font-weight: normal;
font-style: normal;
}
答案 1 :(得分:0)
试试这个
@font-face {
src: local('gnuolane'), url('/path_to/gnuolane.otf') format('truetype');
}