2016-05-07 183 views
-2

儘管遵循了其他問題中的說明,但似乎無法覆蓋Bootstrap的CSS。覆蓋Bootstrap的CSS

<!-- Bootstrap --> 
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">   
<!-- Custom CSS --> 
<link rel="stylesheet" href="css/styles.css"> 
     ... 
<!-- GRID SECTION --> 
<div class="container"> 
    <div class="row"> 
     <div class="col-md-2"> 
     </div> 
     <div class="col-md-8"> 
     <h1 id="title">TITLE</h1>  
     </div> 
     <div class="col-md-2">    
     </div> 
    </div> 
</div> 

的CSS它這樣的:

@font-face { 
    font-family: hnl; 
    src: url('fonts/hnl.otf'); 
} 

body { 
    font-family: hnl; 
} 

#title { 
    font-family: hnl; 
    text-align: center; 
} 

然而,字體不改變,文本不對齊。 如何覆蓋Bootstrap的CSS?

+0

這是一個新手的錯誤與編輯工作,我不得不重新指定文件路徑,但它似乎是現在的工作! – punddalinni

回答

1

你還沒有把你的代碼放在真正的結構中。就像你可以看到這個代碼的工作:

@font-face { 
 
    font-family: hnl; 
 
    src: url('fonts/hnl.otf'); 
 
} 
 

 
body { 
 
    font-family: hnl; 
 
} 
 

 
#title { 
 
    font-family: hnl; 
 
    text-align: center; 
 
}
<!DOCTYPE html> 
 
<html lang="en"> 
 
<head> 
 
    <meta charset="UTF-8"> 
 
    <!-- Bootstrap --> 
 
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">   
 
<!-- Custom CSS --> 
 
<link rel="stylesheet" href="css/styles.css"> 
 
    <title>Document</title> 
 
</head> 
 
<body> 
 
<!-- GRID SECTION --> 
 
<div class="container"> 
 
    <div class="row"> 
 
     <div class="col-md-2"> 
 
     </div> 
 
     <div class="col-md-8"> 
 
     <h1 id="title">TITLE</h1>  
 
     </div> 
 
     <div class="col-md-2">    
 
     </div> 
 
    </div> 
 
</div> 
 
</body> 
 
</html>