4

我想用 css 编码在网上展示 Gotham-Light,但我不会编码。我有两种字体,分别名为 Gotham-Light.eot、Gotham-Light.ttf。现在如何在浏览器上使用?请帮我。

4

3 回答 3

3

像这样定义你的字体:

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

并像往常一样使用它

#someelement {
    font-family: gotham-light;
}
于 2013-02-27T17:40:30.460 回答
2
@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');}
于 2013-07-11T22:58:45.500 回答
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 类

于 2013-02-27T17:38:59.600 回答