更改包含Bootstrap Nav的全角背景颜色

时间:2017-04-29 21:04:56

标签: twitter-bootstrap-3 navbar background-color

  

嘿大家!

     

最终我想将导航栏的颜色更改为#333   全宽,同时仍然具有导航的内容(链接)   包含(不是全宽)。

     

以下是代码:

     

HTML

<!-- navbar -->
>     <nav class="navbar navbar-default navbar-static-top">
>         <div class="container">
>             <div class="navbar-header">
>                 <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false"
>                     aria-controls="navbar">
>             <span class="sr-only">Navigation</span>
>             <span class="icon-bar"></span>
>             <span class="icon-bar"></span>
>             <span class="icon-bar"></span>
>           </button>
>             </div>
>             <div id="navbar" class="navbar-collapse collapse">
>                 <ul class="nav navbar-nav">
>                     <li><a href="#">Home</a></li>
>                     <li><a href="#">Videos</a></li>
>                     <li><a href="#">Photos</a></li>
>                     <li><a href="#">About</a></li>
>                     <li><a href="#">Broadcast</a></li>
>                     <li><a href="#">FAQs</a></li>
>                     <li><a href="#">Contact</a></li>
>                 </ul>
>             </div>
>             <!--/.nav-collapse -->
>         </div>
>     </nav>
>     <!--end of navbar-->
> 
> 
> 
> CSS
> 
> .navbar.navbar-default .navbar-collapse {
>     border: 0;
>     -webkit-box-shadow: none;
>     box-shadow: none; }
> 
> .navbar {
>     margin-bottom: 0 !important;   }
> 
  

当我被困住时,任何帮助都会很棒!

     

提前致谢。

1 个答案:

答案 0 :(得分:0)

.navbar-default {
    background-color: #333 !important;
   
}

.navbar-nav>li>a:hover {
    color:#FFF !important;
    }
 <nav class="navbar navbar-default navbar-static-top">
         <div class="container">
             <div class="navbar-header">
                 <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false"aria-controls="navbar">
                     
             <span class="sr-only">Navigation</span>
             <span class="icon-bar"></span>
             <span class="icon-bar"></span>
             <span class="icon-bar"></span>
           </button>
             </div>
             <div id="navbar" class="navbar-collapse collapse">
                 <ul class="nav navbar-nav">
                     <li><a href="#">Home</a></li>
                     <li><a href="#">Videos</a></li>
                    <li><a href="#">Photos</a></li>
                     <li><a href="#">About</a></li>
                     <li><a href="#">Broadcast</a></li>
                     <li><a href="#">FAQs</a></li>
                    <li><a href="#">Contact</a></li>
                </ul>
             </div>
             <!--/.nav-collapse -->
         </div>
     </nav>