我想在我的网站上为我的 Logo 添加两种字体,Bebas Neue Regular 和 Bebas Neue Thin。
我使用 font-squirrels 在线字体转换工具转换了我的字体,并将相关的@font-face 代码添加到我的 css 中:
@font-face {
font-family: BebasNeueReg;
src: url("/fonts/BebasNeueRegular.eot");
src: url("/fonts/BebasNeueRegular.eot?#iefix") format('embedded-opentype'),
url("/fonts/BebasNeueRegular.woff2") format('woff2'),
url("/fonts/BebasNeueRegular.woff") format('woff'),
url("/fonts/BebasNeueRegular.ttf") format('truetype'),
url("/fonts/BebasNeueRegular.svg") format('svg');
}
如您所见,这是 Bebas Neue Regular 的 @font-face css。由于某些奇怪的原因,Bebas Neue Thin 的 css @font-face 在所有浏览器中都可以正常工作。除了 src 不同之外,此 css 完全相同。
@font-face {
font-family: BebasNeueThin;
src: url("/fonts/BebasNeueThin.eot");
src: url("/fonts/BebasNeueThin.eot?#iefix") format('embedded-opentype'),
url("/fonts/BebasNeueThin.woff2") format('woff2'),
url("/fonts/BebasNeueThin.woff") format('woff'),
url("/fonts/BebasNeueThin.ttf") format('truetype'),
url("/fonts/BebasNeueThin.svg") format('svg');
}
我尝试了多种方法,例如使用不同的字体转换工具转换字体,交换 url 的顺序。
任何人都可以阐明一下吗?以前有人遇到过完全相同的问题吗?
提前致谢。
最佳答案
我清除了所有内容并重新开始。下载我想成为元素一部分的字体,然后使用网络字体生成器将它们转换为网络字体。然后我将它们添加回元素并使用了压缩文件中的 CSS @font-face。这似乎有固定的东西。可能是我一开始尝试转换的损坏的开放式字体。
关于css - 字体不会在任何版本的 Internet Explorer 上加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29577861/