2016-05-07 179 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>