2017-03-07 78 views
1

好的,所以我試圖使用自定義CSS文件自定義基本引導程序導航欄,該文件包含在bootstrap cdn後面的html文件中。在那裏應用的其他風格工作得很好,但我無法弄清楚爲什麼導航欄背景顏色沒有改變。這是我的代碼。提前致謝。爲什麼導航欄自定義樣式不適用引導程序

.navbar-custom{ 
 
    background-color: #0e3572; 
 
} 
 
.jumbotron{ 
 
    background-color: #15438e; 
 
    text-align: center; 
 
} 
 
.jumbotron p{ 
 
    color:white; 
 
    font-family: "Bookman Old Style"; 
 
} 
 
.jumbotron h2{ 
 
    color:white; 
 
    font-family: "Bookman Old Style"; 
 
}
<!DOCTYPE html> 
 
<html> 
 

 
<head> 
 
    <meta charset="UTF-8"> 
 
    <meta lang="en"> 
 
    <meta http-equiv="X-UA-COMPATIBLE" content="IE=edge"> 
 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
 
    <title>PixelCoward Studios</title> 
 

 
    <!-- Latest compiled and minified CSS --> 
 
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> 
 

 
    <!-- custom css --> 
 
    <link rel="stylesheet" type="text/css" href="main.css"> 
 
    <!-- JQuery --> 
 
    <script 
 
      src="https://code.jquery.com/jquery-3.1.1.js" 
 
      integrity="sha256-16cdPddA6VdVInumRGo6IbivbERE8p7CQR3HzTBuELA=" 
 
      crossorigin="anonymous"></script> 
 
    <!-- JQuery UI --> 
 
    <script 
 
      src="https://code.jquery.com/ui/1.12.1/jquery-ui.js" 
 
      integrity="sha256-T0Vest3yCU7pafRw9r+settMBX6JkKN06dqBnpQ8d30=" 
 
      crossorigin="anonymous"></script> 
 
    <!-- Latest compiled and minified JavaScript --> 
 
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> 
 
</head> 
 

 
<body> 
 

 
    <header> 
 

 
     <nav class = "navbar navbar-default navbar-custom navbar-fixed-top" role = "navigation"> 
 
      <div class="container-fluid"> 
 
       <div class = "navbar-header"> 
 
        <button type = "button" class = "navbar-toggle" 
 
          data-toggle = "collapse" data-target = "#example-navbar-collapse"> 
 
         <span class = "sr-only">Toggle navigation</span> 
 
         <span class = "icon-bar"></span> 
 
         <span class = "icon-bar"></span> 
 
         <span class = "icon-bar"></span> 
 
        </button> 
 

 
        <a class = "navbar-brand" href = "#">PixelCoward Studios</a> 
 
       </div> 
 

 
       <div class = "collapse navbar-collapse" id = "example-navbar-collapse"> 
 

 
        <ul class = "nav navbar-nav navbar-right"> 
 
         <li class = "active"><a href = "#">About Us</a></li> 
 
         <li><a href = "#">Our Work</a></li> 
 

 
         <li class = "dropdown"> 
 
          <a href = "#" class = "dropdown-toggle" data-toggle = "dropdown"> 
 
           Contact 
 
           <b class = "caret"></b> 
 
          </a> 
 

 
          <ul class = "dropdown-menu"> 
 
           <li><a href = "#">Team</a></li> 
 
           <li><a href = "#">Credits</a></li> 
 
           <li class = "divider"></li> 
 
           <li><a href = "#">Email Us</a></li> 
 
          </ul> 
 

 
         </li> 
 

 
        </ul> 
 
       </div> 
 
      </div> 
 
     </nav> 
 
    </header> 
 

 
    <section> 
 
     <div class="jumbotron"> 
 
      <h2>Hello there!</h2> 
 
      <p>We are an IT company specialized in developing mobile apps and websites</p> 
 
     </div> 
 
    </section> 
 

 
</body> 
 

 
</html>

+0

哪些款式不適用?您列出它們的順序和優先順序在此處非常重要。 – DavidG

+0

背景顏色正在改變:http://www.codeply.com/go/q7r8svZbHs – ZimSystem

+0

@ZimSystem它也改變了我的瀏覽器,但不工作在堆棧溢出代碼片段..只是好奇......你可以提出一個解釋爲了那個原因? – neophyte

回答

0

所有的自定義CSS添加到頁面,並將其命名custom.css 現在頭中的引導CSS線下添加一個新行這樣

**<!-- Bootstrap Core CSS --> 
<link href="css/bootstrap.min.css" rel="stylesheet"> 
<!-- Custom CSS: You can use this stylesheet to override any Bootstrap styles and/or apply your own styles --> 
    <link href="css/custom.css" rel="stylesheet">**