基於bootstrap實現收縮導航條


<!DocType html>
<html>
<head>
 <meta charset="utf-8">
 <!--設置瀏覽器優先使用什么模式來渲染頁面-->
 <!--告訴IE瀏覽器,IE8/9及以后的版本都會以最高版本IE來渲染頁面。 -->
 <meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta name="viewport" content="width=divice-width,initial-scale=1,maximum-scale=1,user-scalable=no">
 <!-- width:viewport的寬度
   width=divice-width:viewport的寬度 
   initial-scale:初始的縮放比例 
   maxmum-scale:允許用戶縮放的最大比例
   user-scalable:是否允許用戶手動縮放
 --->
 
 <link href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css" rel="external nofollow" rel="stylesheet"> 
 </head>
 <body>
 
  <ul class="navbar navbar-default navbar-fixed-top">
  <!--navbar表示導航條
    navbar-defaule默認導航條樣式
    navbar-fixed-top導航固定在頂部-->
  <div class="container-fluid">
   <!--導航頭部-->
   <div class="navbar-header">
    <a href="index.html" rel="external nofollow" class="navbar-brand">
    <span class="glyphicon glyphicon-home">
    </span>
    <!--導航折疊按鈕-->
    <button class="navbar-toggle" data-toggle="collspan" data-target="#divNav">
 
    <!---   navbar-toggle:【觸發】按鈕,會有下拉導航    data-toggle:交替執行某動作,collapse:展開和收縮
          data-target:目標對象(自己定義一個名字-->
 
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
    <!--按鈕里的內容,三條橫杠-->
 
    </button>
    <!--點擊按鈕將顯示的導航欄目-->
    <div id="divNav" class="collapse nav-collapse">
     <!--這里的div的id要和上面的data-target值一致,nav-collapse就是折疊導航--->
     <ul class="nav navbar-nav">
      <li>首頁</li>
      <li>菜單1</li>
      <li>菜單2</li>
      <li>菜單3</li>
     </ul>
    </div>
   </div>
  </div> 
  </ul>
 </body>
</html>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM