2016-11-23 97 views
0

我想讓導航欄元素從邊緣開始。有點像amazon這樣做。我使用bootstrap基本主題,它有一個可摺疊的導航欄div,我認爲它阻止我移動它們,但是我不確定。Bootstrap,無法將導航欄元素移動到最左側

<!DOCTYPE html> 

<meta charset="utf-8"> 
<meta http-equiv="X-UA-Compatible" content="IE=edge"> 
<meta name="viewport" content="width=device-width, initial-scale=1"> 
<meta name="description" content=""> 
<meta name="author" content=""> 

<title>SheetPal</title> 

<link href="css/navbar.css" rel="stylesheet"> 
<link href="css/bootstrap.min.css" rel="stylesheet"> 

<style> 
body { 
    padding-top: 70px; 
} 
</style> 

<nav class="navbar navbar-inverse navbar-fixed-top" style="background-color: #2555a3; border-bottom: none;" role="navigation"> 
    <div class="container"> 

     <div class="navbar-header"> 
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> 
       <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="#">SheetPal</a> 
      <a class="navbar-brand" href="#">Dashboard</a> 
      <a class="navbar-brand" href="#">Your Hours</a> 
     </div> 

     <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> 
      <ul class="nav navbar-nav navbar-right"> 
       <li> 
        <a href="#"> 
         User 
        </a> 
       </li> 
       <li> 
        <a href="#">Support</a> 
       </li> 
      </ul> 
     </div> 

    </div> 

</nav> 

回答

3
你需要使用 .container-fluid獲得您的需求

。請檢查代碼

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/> 
 
<nav class="navbar navbar-inverse navbar-fixed-top" style="background-color: #2555a3; border-bottom: none;" role="navigation"> 
 
    <div class="container-fluid"> 
 

 
     <div class="navbar-header"> 
 
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> 
 
       <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="#">SheetPal</a> 
 
      <a class="navbar-brand" href="#">Dashboard</a> 
 
      <a class="navbar-brand" href="#">Your Hours</a> 
 
     </div> 
 

 
     <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> 
 
      <ul class="nav navbar-nav navbar-right"> 
 
       <li> 
 
        <a href="#"> 
 
         User 
 
        </a> 
 
       </li> 
 
       <li> 
 
        <a href="#">Support</a> 
 
       </li> 
 
      </ul> 
 
     </div> 
 

 
    </div> 
 

 
</nav>

相關問題