如何在Gotham-Light字体中使用@ font-face?

时间:2013-02-26 20:01:06

标签: html5 css3 font-face

我想用css编码在网上显示Gotham-Light,但我无法编码。我有两个名为Gotham-Light.eot,Gotham-Light.ttf的字体。现在我如何在浏览器上使用?请帮帮我。

3 个答案:

答案 0 :(得分:2)

像这样定义你的字体:

@font-face{
   font-family: gotham-light;
   src: url('gotham-light.ttf') url('gotham-light.eot');
}

并像平常一样使用它

#someelement {
    font-family: gotham-light;
}

答案 1 :(得分:1)

@font-face {
    font-family: 'GothamLight';
    src: url('/fonts/Gotham-Light.eot');
    src: url('/fonts/Gotham-Light.otf') format('opentype'),
         url('/fonts/Gotham-Light.eot?iefix') format('embedded-opentype'),
         url('/fonts/Gotham-Light.woff') format('woff'),
         url('/fonts/Gotham-Light.ttf') format('truetype'),
         url('/fonts/Gotham-Light.svg#gothamlight') format('svg');}

答案 2 :(得分:0)

这不适用于IE,但FF和Chrome可以做到这一点

@font-face{
font-family: gotham-light;
src: url('gotham-light.ttf');
}

@font-face{
font-family: gotham-light;
src: url('gotham-light.eot');
}

然后将font-family应用于css中所需的任何类