本文實(shí)例為大家分享了bootstrap實(shí)現(xiàn)收縮導(dǎo)航條的具體代碼,供大家參考,具體內(nèi)容如下
效果圖
貼上我的代碼
<!DocType html><html><head> <meta charset="utf-8"> <!--設(shè)置瀏覽器優(yōu)先使用什么模式來渲染頁面--> <!--告訴IE瀏覽器,IE8/9及以后的版本都會(huì)以最高版本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:是否允許用戶手動(dòng)縮放 ---> <link rel="external nofollow" rel="stylesheet"> </head> <body> <ul class="navbar navbar-default navbar-fixed-top"> <!--navbar表示導(dǎo)航條 navbar-defaule默認(rèn)導(dǎo)航條樣式 navbar-fixed-top導(dǎo)航固定在頂部--> <div class="container-fluid"> <!--導(dǎo)航頭部--> <div class="navbar-header"> <a href="index.html" rel="external nofollow" class="navbar-brand"> <span class="glyphicon glyphicon-home"> </span> <!--導(dǎo)航折疊按鈕--> <button class="navbar-toggle" data-toggle="collspan" data-target="#divNav"> <!--- navbar-toggle:【觸發(fā)】按鈕,會(huì)有下拉導(dǎo)航 data-toggle:交替執(zhí)行某動(dòng)作,collapse:展開和收縮 data-target:目標(biāo)對(duì)象(自己定義一個(gè)名字--> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> <!--按鈕里的內(nèi)容,三條橫杠--> </button> <!--點(diǎn)擊按鈕將顯示的導(dǎo)航欄目--> <div id="divNav" class="collapse nav-collapse"> <!--這里的div的id要和上面的data-target值一致,nav-collapse就是折疊導(dǎo)航---> <ul class="nav navbar-nav"> <li>首頁</li> <li>菜單1</li> <li>菜單2</li> <li>菜單3</li> </ul> </div> </div> </div> </ul> </body></html>
這就完成了。
以上就是本文的全部內(nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持武林網(wǎng)。
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注