2016-10-25 444 views
0

我想使bootstrap導航欄更小,並保持它正確,但小問題在這裏我有一些數據動態加載在網格的右側,由導航欄重疊,所以我想保持導航欄左右偏移3列左右,所以我添加了CSS類container-panel使寬度更小,並保持它的權利,我有餘裕left.But在不同的像素,它打破和導航欄重疊在其他元素。是否有任何修復引導來實現這一任務?如何讓bootstrap navbar的寬度更小?

main.html中

<div class="col-md-10"> 
    <nav class="navbar navbar-default container-panel"> 
     <div class="container-fluid"> 
      <!-- Brand and toggle get grouped for better mobile display --> 
      <div class="navbar-header"> 
       <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false"> 
       <span class="sr-only">Toggle navigation</span> 
       <span class="icon-bar"></span> 
       </button> 
      </div> 

      <!-- Collect the nav links, forms, and other content for toggling --> 
      <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1" style="z-index:10;"> 
       <ul class="nav navbar-nav pull-right"> 
        <li class="dropdown"> 
         <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="glyphicon glyphicon-file"></span><span class="caret"></span></a> 
         <ul class="dropdown-menu"> 
          <li><a href="#"><span ng-click="createXml()">Create new BPMN Diagram</span></a></li> 
         </ul> 
        </li> 
        <li><a href="#"><span class="glyphicon glyphicon-folder-open"></span></a></li> 
       </ul> 
      </div> 
     </div> 
    </nav> 
</div> 

的main.css

.navbar.container-panel { 
    width:554px; 
    margin-left: 760px; 
} 

回答

0

使用的可變寬度,像VW或%至相對於屏幕寬度的寬度相適應。您可能需要在較小的斷點處調整vw或%,以免切斷導航欄內容。

.navbar.container-panel { 
    width:60vw; 
    margin-left: 760px; 
} 

.navbar.container-panel { 
    width:60%; 
    margin-left: 760px; 
} 
相關問題