【问题标题】:@font-face not working for IE, but is working for chrome?@font-face 不适用于 IE,但适用于 chrome?
【发布时间】:2014-01-06 23:32:35
【问题描述】:

因此尝试将自定义 @font-face 字体添加到我的 asp.net 项目中。可以在 chrome 浏览器中运行...

@font-face
{
font-family: "Century Gothic";
src: url('GOTHIC.TTF'),
}

body {
background-color: #fff;
border-top: solid 10px #000;
color: #333;
font-size: .85em;
font-family: "Century Gothic", Segoe UI, Verdana, Helvetica, Sans-Serif;
margin: 0;
padding: 0;
}

但需要其他人的帮助......(这是我的尝试)......但不起作用:

@font-face
{
font-family: "Century Gothic";
    src: url('../GOTHIC.eot');
    src: url('../GOTHIC.eot?#iefix') format('embedded-opentype'),
        url('../GOTHIC.woff') format('woff'),
        url('../GOTHIC.ttf') format('truetype'),
        url('../GOTHIC.svg#URWClassicoItalic') format('svg');
    font-weight: normal;
    font-style: normal;
}

我也不确定我是否需要 .eot、.woff 等扩展名。我只加了

GOTHIC.TTF
GOTHICB.TTF
GOTHICBI.TTF
GOTHICI.TTF to my prjoect.

工作地点:

http://stackoverflow.com/questions/8115302/font-face-not-working-even-after-trying-everything-i-could-think-of?rq=1

http://stackoverflow.com/questions/6238737/font-face-with-embedded-font-does-not-work?rq=1

http://stackoverflow.com/questions/20659571/adding-a-custom-font-to-vs-2010-fontface

【问题讨论】:

标签: c# asp.net fonts font-face webfonts


【解决方案1】:

我认为问题在于跨域使用字体。

因此,以“http://stackoverflow.com/questions/8115302/font-face-not-working-even-after-trying-everything-i-could-think-of?rq=1” 开头的 URL 被视为与 “http://www.stackoverflow.com/questions/8115302/font-face-not-working-even-after-trying-everything-i-could-think-of?rq=1” 位于不同的域中,即使您看到该域名指向系统的同一位置。

你需要切换到相对网址来解决问题

您也可以查看Cross domain workaround for @font-face and Firefox,这会对您有所帮助。

【讨论】:

  • 目前的问题并非如此——因为缺乏对 TTF 字体类型的支持,IE 没有显示字体。
【解决方案2】:

你需要eot、woff等文件扩展名——IE678不支持TTF格式,只支持EOT

【讨论】:

    猜你喜欢
    • 2011-02-20
    • 2014-03-04
    • 2014-03-17
    • 2012-06-22
    • 1970-01-01
    • 2011-01-18
    • 1970-01-01
    • 1970-01-01
    • 2019-08-06
    相关资源
    最近更新 更多