成人午夜视频全免费观看高清-秋霞福利视频一区二区三区-国产精品久久久久电影小说-亚洲不卡区三一区三区一区

bootstrap中的導(dǎo)航條實(shí)例代碼詳解

一、和導(dǎo)航的區(qū)別

10年積累的做網(wǎng)站、成都網(wǎng)站制作經(jīng)驗(yàn),可以快速應(yīng)對(duì)客戶(hù)對(duì)網(wǎng)站的新想法和需求。提供各種問(wèn)題對(duì)應(yīng)的解決方案。讓選擇我們的客戶(hù)得到更好、更有力的網(wǎng)絡(luò)服務(wù)。我雖然不認(rèn)識(shí)你,你也不認(rèn)識(shí)我。但先制作網(wǎng)站后付款的網(wǎng)站建設(shè)流程,更有察隅免費(fèi)網(wǎng)站建設(shè)讓你可以放心的選擇與我們合作。

1.導(dǎo)航條比導(dǎo)航多了一個(gè)條字

2.直接上圖

導(dǎo)航:

bootstrap中的導(dǎo)航條實(shí)例代碼詳解

 導(dǎo)航條:

bootstrap中的導(dǎo)航條實(shí)例代碼詳解

簡(jiǎn)單文字描述: 由兩張圖看出,導(dǎo)航內(nèi)容比較簡(jiǎn)單,而導(dǎo)航條可以包含導(dǎo)航及其他元素,如表單,搜索框等,并且通常導(dǎo)航條會(huì)有一個(gè)區(qū)別于頁(yè)面的背景色。

二、在頁(yè)面中定義導(dǎo)航條

方法:

為父容器添加類(lèi)名navbar navbar-default。navbar-default類(lèi)用來(lái)規(guī)定導(dǎo)航條的顏色,可以更改為navbar-inverse來(lái)讓導(dǎo)航條反色顯示。bootstrap官網(wǎng)建議使用nav元素。但也常用div元素,建議用div元素時(shí)增加role="navigation"屬性,該屬性對(duì)一些特殊的輔助設(shè)備友好。

結(jié)構(gòu):

標(biāo)題或者logo放在類(lèi)名為.navbar-header>.navbar-brand的容器中,其他條目可以放在類(lèi)名為.nav navbar-nav的容器中

<div class="navbar navbar-default" role="navigation">
  <div class="navbar-header">
   <a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" class="navbar-brand">MY WEBSITE</a>
  </div>
 <ul class="nav navbar-nav">
  <li class="active"><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >首頁(yè)</a></li>
   <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >條目一</a></li>
   <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >條目二</a></li>
   <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >條目三</a></li>
   <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >條目四</a></li>
 </ul>
</div>

包含元素:

1.表單:form 添加類(lèi)名navbar-form
2.按鈕:添加類(lèi)名navbar-btn(需和類(lèi)名為“navbar-nav”或"navbar-brand"的元素配合使用,且數(shù)量不能多)
3.文本:添加類(lèi)名navbar-text(需和類(lèi)名為“navbar-nav”或"navbar-brand"的元素配合使用,且數(shù)量不能多)
4.鏈接:添加類(lèi)名navbar-link(需和類(lèi)名為“navbar-nav”或"navbar-brand"的元素配合使用,且數(shù)量不能多)
5.二級(jí)菜單:(見(jiàn)下面代碼)

<div class="navbar navbar-default" role="navigation">
  <div class="navbar-header">
   <a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" class="navbar-brand">MY WEBSITE</a>
  </div>
 <ul class="nav navbar-nav">
  <li class="active"><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >首頁(yè)</a></li>
  <li class="dropdown">
   <a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" data-toggle="dropdown" class="dropdown-toggle">水果<span class="caret"></span></a>
   <ul class="dropdown-menu">
   <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >蘋(píng)果</a></li>
   <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >橘子</a></li>
   <li ><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >香蕉</a></li>
   </ul>
  </li>
  <li><a href="##" rel="external nofollow" rel="external nofollow" rel="external nofollow" >蔬菜</a></li>
  <li><a href="##" rel="external nofollow" rel="external nofollow" rel="external nofollow" >哈哈</a></li>
  <li><a href="##" rel="external nofollow" rel="external nofollow" rel="external nofollow" >呵呵</a></li>
 </ul>
</div>

位置樣式:

•導(dǎo)航條內(nèi)元素左浮動(dòng):左浮動(dòng)的元素添加類(lèi)名navbar-left
•導(dǎo)航條內(nèi)元素右浮動(dòng):右浮動(dòng)的元素添加類(lèi)名navbar-right
•導(dǎo)航條固定在瀏覽器窗口頂部:導(dǎo)航條父容器添加類(lèi)名navbar-fixed-top
•導(dǎo)航條固定在瀏覽器窗口底部:導(dǎo)航條父容器添加類(lèi)名navbar-fixed-bottom

注意:讓導(dǎo)航條固定在瀏覽器窗口頂部或底部會(huì)遮蓋到頁(yè)面頂部或底部的內(nèi)容,解決辦法為:給body設(shè)置合適的內(nèi)邊距(溫馨提示:導(dǎo)航條默認(rèn)高度為50px)。

三、響應(yīng)式

目的: 讓導(dǎo)航條內(nèi)容比較多的時(shí)候,在窄屏幕設(shè)備上顯示更加友好

表現(xiàn): 寬屏正常顯示,窄屏?xí)r隱藏一部分條目,并調(diào)整其排列方式為垂直排列,然后通過(guò)一個(gè)按鈕單擊顯示

寬屏顯示:

bootstrap中的導(dǎo)航條實(shí)例代碼詳解

 窄屏顯示:

bootstrap中的導(dǎo)航條實(shí)例代碼詳解

 窄屏展開(kāi):

bootstrap中的導(dǎo)航條實(shí)例代碼詳解

方法:

1.將想要被折疊的元素包裹在一個(gè)類(lèi)名為"collapse navbar-collapse"的div中

2.定義想要顯示的圖標(biāo),可以將其放在類(lèi)名為“navbar-header”的元素中

<button class="navbar-toggle" type="button" data-toggle="collapse">
 <span class="sr-only">Toggle Navigation</span>
 <span class="icon-bar"></span>
 <span class="icon-bar"></span>
 <span class="icon-bar"></span>
</button>

完整代碼:

<div class="navbar navbar-default" role="navigation">
 <div class="navbar-header">
  <button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".test">
   <span class="sr-only">Toggle Navigation</span>
   <span class="icon-bar"></span>
   <span class="icon-bar"></span>
   <span class="icon-bar"></span>
  </button>
  <a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" class="navbar-brand">LOGO</a>
 </div>
 <div class="collapse navbar-collapse test">
  <ul class="nav navbar-nav">
   <li class="active"><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >首頁(yè)</a></li>
   <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >條目一</a></li>
   <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >條目二</a></li>
   <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >條目三</a></li>
   <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >條目四</a></li>
   <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >條目五</a></li>
  </ul>
 </div>
</div>

1.為隱藏元素的父標(biāo)簽添加一個(gè)class類(lèi)名或id名,然后讓button的data-target鏈接到該元素:data-target=".class/#id"

響應(yīng)式的臨界點(diǎn)為768px,即當(dāng)屏幕大于768px時(shí)原樣顯示,小于768px時(shí)改變樣式

路徑導(dǎo)航(面包屑導(dǎo)航)

<ol class="breadcrumb">
 <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >Home</a></li>
 <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >Library</a></li>
 <li class="active">Data</li>
</ol>

樣式:

bootstrap中的導(dǎo)航條實(shí)例代碼詳解

總結(jié)

以上所述是小編給大家介紹的bootstrap中的導(dǎo)航條實(shí)例代碼詳解,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)創(chuàng)新互聯(lián)網(wǎng)站的支持!
如果你覺(jué)得本文對(duì)你有幫助,歡迎轉(zhuǎn)載,煩請(qǐng)注明出處,謝謝!

文章標(biāo)題:bootstrap中的導(dǎo)航條實(shí)例代碼詳解
網(wǎng)頁(yè)鏈接:http://jinyejixie.com/article26/ipisjg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供虛擬主機(jī)、外貿(mào)網(wǎng)站建設(shè)做網(wǎng)站、面包屑導(dǎo)航、微信公眾號(hào)、品牌網(wǎng)站設(shè)計(jì)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

綿陽(yáng)服務(wù)器托管
扎鲁特旗| 湘潭市| 谢通门县| 和田县| 济源市| 武定县| 县级市| 义马市| 六安市| 万安县| 长岭县| 南召县| 读书| 栾川县| 教育| 精河县| 罗甸县| 普兰店市| 久治县| 阳新县| 合作市| 栖霞市| 潼关县| 彩票| 缙云县| 防城港市| 丰都县| 滦南县| 静乐县| 达拉特旗| 托克托县| 兴山县| 屏南县| 绥芬河市| 广昌县| 都昌县| 山东省| 淳安县| 金溪县| 个旧市| 清水县|