2015-08-14 83 views
-1

我想使用字體bmI0GxZww8t20K342Lco0g.woff2進行分類,但它不是以該字體呈現;我究竟做錯了什麼?爲什麼我的首選CSS字體沒有被使用?

<html> 
<head> 
<style> 
.classa {color:blue} 
.classb {font-family:Arial, Helvetica, sans-serif; color:blue} 
.classc { 
    font-family: TimesNewRoman, 'Times New Roman', Times, Baskerville, Georgia, serif; 
    font-size: 30px; 
    font-style: normal; 
    font-variant: normal; 
    font-weight: 500; 
    line-height: 15.3999996185303px; 
    color:blue; 
} 
.classd @font-face { 
    font-family: MyFont; 
    src: 
     url('bmI0GxZww8t20K342Lco0g.woff2') format('woff2'), 
     url('bmI0GxZww8t20K342Lco0g.woff') format('woff'); 
} 
<link rel="stylesheet" type="text/css" href="csss.css"> 

</style> 
</sead> 
<h1 class="classa">Bro This Is Blue.</h1> 
<h1 class="classb">Bro This Is Blue.</h1> 
<h1 class="classc">Bro This Is Blue.</h1> 
<h1 class="classd">Bro.</h1> 
</html> 
+0

'行高:15.3999996185303px;'??? – Nabi

+0

歡迎來到SO!確保你在這個網站上前進,使用更好的標題 - 這將有助於它更好地被注意到。在這裏張貼的每個人都有一個需要解決的問題,對吧? – patricksweeney

回答

0

既然你已經要求一步一步地做到這一點,

將以下代碼複製/粘貼到IDE(Notepad ++/Dreamweaver)上,將其另存爲jura.css文件。

@font-face { 
    font-family: 'Jura'; 
    font-style: normal; 
    font-weight: 400; 
    src: local('Jura Regular'), local('Jura-Regular'), url(http://fonts.gstatic.com/s/jura/v7/TTP6pkLK4ssO46rAsyf3PA.woff2) format('woff2'); 
    unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F; 
} 

上面的字體可在http://conieco.com.mx/conieco_files/css

打開HTML文件,包括jura.css文件

<link rel = "stylesheet" href= "jura.css" /> 

如果文件jura.css是在另一個文件夾,但在相同的目錄中html文件使用這個;

<link rel = "stylesheet" href= "CSS/jura.css" /> 

如果jura.css文件是在另一個文件夾是在隨後的先前存儲的路徑;

<link rel = "stylesheet" href= "../CSS/jura.css" /> 

現在你可以簡單地使用字體;

.classd 
    { 
    font-family: Jura; 
    } 

注:<link/>標籤而來的<head></head>標籤內。

Fiddle

+0

沒有工作在nateproductions @ hotmail給我發送完整的代碼(使用我的源代碼)。com –

+0

或粘貼垃圾箱。 –

+0

@MRCurriNate請檢查編輯。 – user5173426

0

把這個風格部分:

@font-face { 
    font-family: 'Jura'; 
    font-style: normal; 
    font-weight: 400; 
    src: local('Jura Regular'), local('Jura-Regular'), url(http://fonts.gstatic.com/s/jura/v7/bmI0GxZww8t20K342Lco0g.woff2) format('woff2'); 
    unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; 
} 

而且在.classd

font-family: "Jura", sans-serif; 
+0

你能拿我的代碼,把它放在那裏嗎?因爲我是編碼語言的新手。 –

+0

它不適用於我 –

+0

我可以把它放在一個css文件 –

0

的@字體面對面聲明應該是從類規則分開。基本上,它會將字體添加到可用於設置元素樣式的可用字體列表中。一旦你宣佈你的字體,那麼你可以申請你選擇.classd

@font-face { 
    font-family: MyFont; 
    src: 
     url('bmI0GxZww8t20K342Lco0g.woff2') format('woff2'), 
     url('bmI0GxZww8t20K342Lco0g.woff') format('woff'); 
} 

.classd { 
    font-family: MyFont; 
} 

根據您的字體文件存儲在字體系列名稱,你可能還需要編輯字體的網址,以確保他們指向正確的位置。

相關問題