我正在使用此css但它无法正常工作。
@font-face {
font-family: OpenSans-Bold;
src: url('../design_images/font/OpenSans-Bold.eot'); /* EOT file for IE */
font-weight:normal;
font-style:normal;
}
@font-face {
font-family: OpenSans-Regular;
src:url('font/OpenSans-Regular.eot');
font-weight:normal;
font-style:normal;
}
@font-face {
font-family: Oswald-Regular;
src: url('font/Oswald-Regular.eot');
font-weight:normal;
font-style:normal;
}
@font-face {
font-family:OpenSans-Regular;
src: url('font/OpenSans-Regular.ttf'); /* TTF file for CSS3 browsers */
font-weight:normal;
font-style:normal;
}
@font-face {
font-family:OpenSans-Bold;
src: url('font/OpenSans-Bold.ttf');
font-weight:normal;
font-style:normal;
}
@font-face {
font-family: Oswald-Regular;
src: url('font/Oswald-Regular.otf');
}
.newr {
font-family:Oswald-Regular;
font-size:20px;
font-style:normal;
font-smooth:Crisp;
font-weight:normal;
color:#f9e211;
text-transform:uppercase;
margin:21px 0 0 25px;
}
答案 0 :(得分:2)
有时候,我会将常规字体转换为webfonts,使它们看起来更流畅,更清晰,并将它们添加到我的CSS中,如下所示:
@font-face {
font-family: 'ArvoRegular';
src: url('Arvo-Regular-webfont.eot');
src: url('Arvo-Regular-webfont.eot?#iefix') format('embedded-opentype'),
url('Arvo-Regular-webfont.woff') format('woff'),
url('Arvo-Regular-webfont.ttf') format('truetype'),
url('Arvo-Regular-webfont.svg#ArvoRegular') format('svg');
font-weight: normal;
font-style: normal;
}
搜索@ font-face Generators以生成所需的字体。
答案 1 :(得分:1)
使用它:
@font-face{
font-family: fontFamilyNameHere ;
src: url(.eot file path here); /* For IE */
src: local("fontNameHere"), url(.ttf file path here) format("truetype"); /* non-IE */
font-weight:normal;
font-style:normal;
}
答案 2 :(得分:0)
看起来你的src属性中有两个不同的路径。一个是
src:url('../ design_images / font / OpenSans-Bold.eot'); / * IE * /
的EOT文件
其他人
的src:URL( '字体/ OpenSans-Regular.eot');
为什么一条路径链接到../design_images/font/
而另一条路径只链接到font/
?这可能是您的问题,取决于您的目录结构。我以为我会指出这一点。