2013-02-19 32 views
-1

我正在使用此css,但它無法正常工作。字體在Chrome中無法正常工作

@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

定義「工作不正常」並指定使用的瀏覽器。 – 2013-02-19 12:16:25

回答

0

看起來你在src屬性中有兩個不同的路徑。一個是

src:url('../ design_images/font/OpenSans-Bold.eot');/*用於IE */

EOT文件和其它的是

SRC:URL( '字體/ OpenSans-Regular.eot');

爲什麼一條路徑連接到../design_images/font/,另一條路徑連接到font/?這可能是你的問題,取決於你的目錄結構。只是想我會指出。

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

有時候,我轉換常規字體網絡字體,使它們看起來更光滑和清潔,並在我的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生成器以生成所需的字體。

相關問題