2016-04-27 76 views
2

儘管看着其他答案,我不能讓Bootstrap不覆蓋我想使用的Google字體。我試圖改變我的樣式表的位置,但沒有任何工作。
任何幫助,這將不勝感激。引導覆蓋谷歌字體

http://codepen.io/01scatman/pen/KzGdNY

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"> 
    <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> 
    <link rel="stylesheet" type="text/css" href="AOS-TC.css"> 
    <link href='https://fonts.googleapis.com/css?family=Arvo:400,700' rel='stylesheet' type='text/css'> 
+0

你在哪裏指定你的CSS中的「arvo」字體。使用'@ font-face' CSS規則來做到這一點。 – ahPo

+0

它在體內。 – Craig

回答

0

我沒有什麼,但在文檔中的以下內容,它的工作原理。 Bootstrap不會覆蓋字體。

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"> 
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> 
<link rel="stylesheet" type="text/css" href="AOS-TC.css"> 
<link href='https://fonts.googleapis.com/css?family=Arvo' rel='stylesheet' type='text/css'> 

<style> 
    body{ 
    font-family: 'Arvo', serif; 
    } 
</style> 

Hello 
+0

我嘗試了這兩個都沒有工作。我很茫然。 – Craig

+0

看看這個:http://stackoverflow.com/questions/21678458/google-font-not-working-with-bootstrap –

+0

我已經看過這個事先,它沒有幫助。 – Craig

0

也許嘗試加入 「重要的」 對你的身體CSS

body { 
 
    margin: 0; 
 
    padding: .1px; 
 
    position: relative; 
 
    background: url(http://www.adventuresofscatman.com/wp-content/uploads/2015/09/IMG_4273.jpg); 
 
    background-repeat: no-repeat; 
 
    background-size: cover; 
 
    background-color: #555; 
 
    overflow-x: hidden; 
 
    font-family: Arvo !important; 
 
    font-weight: 700; 
 
}

+1

,或者你也可以下載CSS並將其託管到服務器 https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.css 和替換的字體 - 您希望應用Arvo字體的特定標記上的家庭。 –

0

不知道爲什麼字體被覆蓋,但可以使用fontSwitcher(上CodePen)申請它。我在你的筆上試過,它適用於阿沃。該行添加到頭:

<script src="http://codepen.io/freginold/pen/vLJewY.js"></script>

而此行的JavaScript部分:

fontSwitcher('fontName', 'elementClass');

fontSwitcher應用由類谷歌的字體,所以如果你想將它應用到全身,分配一個類到身體,然後將字體應用到該類。

還可以指定後備字體,像這樣:

fontSwitcher('fontName', 'elementClass'[, 'fallbackFont1', 'fallbackFont2' ...]);

免責聲明:fontSwitcher仍處於進展中的工作,但它的功能齊全。

+0

此外,將'font-family:Arvo;'添加到'.secondary'類將Arvo應用到您的子標題,因此您可能只需要以不同的方式定位字體。 – freginold