大家好!
我目前正在我们自己公司的网站上工作,但我似乎无法让@font-face 正常工作。 这是 css 的样子:
@font-face {
font-family: 'BebasNeue';
src: url('type/BebasNeue-webfont.eot?') format('eot'),
url('type/BebasNeue-webfont.woff') format('woff'),
url('type/BebasNeue-webfont.ttf') format('truetype'),
url('type/BebasNeue-webfont.svg#webfontj1CI1MAi') format('svg');
}
#nav li {
display: inline;
margin-left: 20px;
font-family: BebasNeue, Impact;
font-size: 24px;
color: #333333;
letter-spacing: 1pt;
}
@font-face 导入基本上直接来自 Font Squirrel @font-face 生成器。我还没有发现问题所在,这就是我伸出援手的原因。 我编辑了字体系列名称和字体位置 (../type/)。
感谢任何帮助,如果您需要查看可能与此问题相关的任何其他代码,请告诉我。 干杯。
最佳答案
据我所知,这是实现@font-face 最通用的方法:
@font-face{
/* for IE only (IE doesn't apear to comprehand normal CSS)*/
font-family: "my fancy font";
src: url("/fonts/font.eot");
}
@font-face{
/* for non CSS-challenged browsers */
font-family: "my fancy font";
src: local("☼"),
url("/fonts/font.eot") format('eot'),
url("/fonts/font.woff") format('woff'),
url("/fonts/font.otf") format('otf'),
url("/fonts/font.ttf") format('truetype'),
url("/fonts/font.svg") format('svg');
}
两个@font-face 部分和一些不可能是 src 中的文件名的东西:local()
关于css - @字体问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5586598/