2016-09-26 19 views
0
.title_font{ 
     font-family: montserrat; 
     src: url("/assets/font/Montserrat-Light.otf") format("opentype"); 
} 
    @font-face { 
font-family: 'montserrat'; 
src: url('/assets/font/Montserrat-Light.otf') format("opentype"); 
font-weight: bold; 

}字體臉 - 在OPERA自己的字體不工作,,不明財產」

這些都不是工作......你可以幫我它說未知的屬性...路徑字體是什麼?

+0

這第一個代碼是無效的,但'@ font-face'規則應該工作。 「未知財產」通常表示錯字,您是否可以使用原始代碼創建在線版本? – RoelN

回答

0

可選步驟一:將您的OTF轉換爲WOFF,因爲您希望瀏覽器知道這不僅僅是一個通用的系統字體,而且是一個旨在在線使用。WOFF解析並不像通用系統字體規則,WOFF用可選zlib(WOFF)/ brotli(WOFF2)壓縮包裝ttf/otf源字節,使字體顯着縮小 電線。

然後,不甚至遠程可選步驟2:你定義這個資源時使用的字體族是montserrat的權重設置爲bold(或數值700,它是同樣的事情在CSS中)。因此,當您離開重量時,您的字體資源不適用,因爲這導致重量爲normal/400,因此應該清楚地而不是映射到您顯示的@ font-face聲明。

如果你想要你的字體應用到任何重量,消除你的@font-face聲明font-weight限制,或者更好的是:提供的用於其重量/風格組合,資源的適當列表。

@font-face { 
    font-family: montserrat; 
    src: url(.../regular.woff) format("woff"); 
    style: normal; 
    weight: normal; 
} 

@font-face { 
    font-family: montserrat; 
    src: url(.../light.woff) format("woff"); 
    style: normal; 
    weight: 300; 
} 

@font-face { 
    font-family: montserrat; 
    src: url(.../bolditalic.woff) format("woff"); 
    style: italic; 
    weight: bold; 
} 

等等。

+0

像魅力一樣工作,謝謝 –