2012-08-09 55 views
1

所以IE9吐出一個錯誤上使用谷歌字體包括像下面這樣:IE9 @字體面藍調

<link href="https://fonts.googleapis.com/css?family=Lato:300,400,700,900" rel="stylesheet" type="text/css" /> 

IE9吐出了一個錯誤,即使字體仍然加載罰款:

CSS3111: @font-face encountered unknown error. 

我很樂意忽略這個錯誤,如果我沒有寫在別人的網頁上的內容。 :(

主辦EOT文件本地解決問題的IE瀏覽器:

< !--[if IE 9]> 
< link rel="stylesheet" href="/survey/css/lato-ie.css" type="text/css" /> 
< ![endif]--> 

並在該文件..

@font-face { 
    font-family: "Lato"; 
    font-style: normal; 
    font-weight: 400; 
    src: url("/Lato-Reg-webfont.eot") format("embedded-opentype"); 
} 
@font-face { 
    font-family: "Lato"; 
    font-style: normal; 
    font-weight: 900; 
    src: url("/Lato-Bla-webfont.eot") format("embedded-opentype"); 
} 

包括在IE9中,錯誤的走了,工程巨大

現在我的問題是,我需要爲每個人包括谷歌字體樣式表,但IE9。例如,我不能這樣做:

< !--[if !IE 9]> 
< link href="https://fonts.googleapis.com/css?family=Lato:300,400,700,900" rel="stylesheet" type="text/css" /> 
< ![endif]--> 

或者Firefox甚至不會看到該死的包括。

IE的開發人員正在共謀浪費我們所有的時間嗎?

+0

您是否有強大的缺點讓您爲所有瀏覽器託管字體? – 2012-08-09 17:59:08

+0

沒有什麼比努力和可擴展性(我將需要這樣做的字體,我不能保證我將能夠獲得.woff,.ttf和.svg,更不用說了.eot).. – Amalgovinus 2012-08-10 01:02:10

回答

3

你在正確的軌道上,你只需要使用一個downlevel-revealed conditional comment:它會隱藏它從IE,但會通過其他瀏覽器被拾起。

+1

小心解釋downvote?也許你不明白他的問題,但我的解決方案可以解決它。 – Knu 2012-08-21 02:30:32

+0

我把它升爲零,這對於問題來說是100%的答案,簡潔而又簡單。非常好! – 2012-09-15 16:55:59

0

有一個問題,你想在本地查看你的文件嗎?

谷歌字體不會在本地渲染,即使他們鏈接到絕對的外部鏈接。 (在IE的情況下)

localhost/project/index.html = good 
C:\Project\index.html = bad 
+0

好問題,我通過我的本地服務器查看他們(但不是C:路徑)。 – Amalgovinus 2012-08-10 01:01:12