css - @字体问题

标签 css font-face

大家好!

我目前正在我们自己公司的网站上工作,但我似乎无法让@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/

相关文章:

javascript - HTML5 字体大小根据浏览器大小调整大小 javascript/jquery

html - 未加载字体

css - 将外部字体应用于 CSS 时遇到问题

c# - 嵌入式字体在 IE 上不起作用

html - 使用固定页脚使列位于页面底部

html - 删除 div 周围的空间

html - CSS margin 恐怖; Margin 在父元素之外添加空间

html - 如何使用 CSS 更改 iframe 页面而不更改父页面和外部链接

ruby-on-rails - Rails 3,@font-face 在使用 Firefox 的生产中失败

html - 为什么我的字体渲染缓慢