2016-04-27 75 views
0

自從我加入引導和字體真棒我的HTML文件時,大多數的CSS做之前就消失了(背景顏色,字體,谷歌)添加bootstrap&字體真棒遺蹟css爲什麼?

<head> 
    <meta charset="utf-8"> 
    <title>Games</title> 
    <link rel="stylesheet" href="main.css"> 
    <link rel="stylesheet"href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css"> 
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"> 

    <link href='https://fonts.googleapis.com/css?family=Orbitron:400,500' rel='stylesheet' type='text/css'>  
    <link href='https://fonts.googleapis.com/css?family=Homemade+Apple' rel='stylesheet' type='text/css'> 
</head> 

是否有人知道爲什麼嗎?謝謝!!

+0

您試圖更改訂單嗎? – aldanux

回答

0

將您的main.css文件聲明移動到您的引導程序和font-awesome聲明。由於CSS是級聯後面的樣式會覆蓋您的自定義樣式。

<head> 
    <meta charset="utf-8"> 
    <title>Games</title> 
    <link rel="stylesheet"href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css"> 
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"> 

    <link href='https://fonts.googleapis.com/css?family=Orbitron:400,500' rel='stylesheet' type='text/css'>  
    <link href='https://fonts.googleapis.com/css?family=Homemade+Apple' rel='stylesheet' type='text/css'> 

    <link rel="stylesheet" href="main.css"> 
</head> 
+0

如果引導CSS具有更高的特異性,更改順序不會有所幫助。 – GolezTrol

+0

@GolezTrol通常,Bootstrap不會使用'!important'正是出於這個原因。 – Steve

+1

我不是在說那個。我說[Specificity](https://css-tricks.com/specifics-on-css-specificity/),這不僅僅是添加'!important'。 (反正你也不應該使用'!important') – GolezTrol