2014-12-28 85 views
0

我讀了關於如何安裝的字體服務器的線程,最會看起來像這樣安裝多種字體服務器

@font-face { 
font-family: 'Raspoutine Medium'; 
    src: url(fonts/Raspoutine Medium.ttf); 
} 

body { 
font-family: 'Raspoutine Medium', Arial, Helvetica, san-serif; 
} 

只包含1個網址。但問題是我的字體家族有20個不同的OTF文件(光,常規,書,冥想,沉重,黑色等)。那麼我如何將它們全部安裝到服務器上並引用它們呢?非常感謝你的幫助。

回答

1

最好的辦法是創建不同的font-weightfont-style組合。

@font-face { 
    font-family: 'Raspoutine'; 
    font-weight: 600; 
    font-style: normal; 
    src: url(fonts/Raspoutine Medium.ttf); 
} 
@font-face { 
    font-family: 'Raspoutine'; 
    font-weight: 400; 
    font-style: normal; 
    src: url(fonts/Raspoutine Normal.ttf); 
} 
@font-face { 
    font-family: 'Raspoutine'; 
    font-weight: 100; 
    font-style: normal; 
    src: url(fonts/Raspoutine Light.ttf); 
} 
@font-face { 
    font-family: 'Raspoutine'; 
    font-weight: 100; 
    font-style: Italic; 
    src: url(fonts/Raspoutine Light Italic.ttf); 
} 

那麼你明白了。更多關於數字font-weight的數值可以在MDN

+0

謝謝您的回答。完美的工作。 – Henry