欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

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

 更新時間:2019年05月20日 09:45:52   作者:black_kitty  
本文通過實例代碼給大家介紹了bootstrap中的導(dǎo)航條,非常不錯,具有一定的參考借鑒價值,需要的朋友可以參考下

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

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

2.直接上圖

導(dǎo)航:

 導(dǎo)航條:

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

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

方法:

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

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

標(biāo)題或者logo放在類名為.navbar-header>.navbar-brand的容器中,其他條目可以放在類名為.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" >首頁</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 添加類名navbar-form
2.按鈕:添加類名navbar-btn(需和類名為“navbar-nav”或"navbar-brand"的元素配合使用,且數(shù)量不能多)
3.文本:添加類名navbar-text(需和類名為“navbar-nav”或"navbar-brand"的元素配合使用,且數(shù)量不能多)
4.鏈接:添加類名navbar-link(需和類名為“navbar-nav”或"navbar-brand"的元素配合使用,且數(shù)量不能多)
5.二級菜單:(見下面代碼)

<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" >首頁</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" >蘋果</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)元素左浮動:左浮動的元素添加類名navbar-left
•導(dǎo)航條內(nèi)元素右浮動:右浮動的元素添加類名navbar-right
•導(dǎo)航條固定在瀏覽器窗口頂部:導(dǎo)航條父容器添加類名navbar-fixed-top
•導(dǎo)航條固定在瀏覽器窗口底部:導(dǎo)航條父容器添加類名navbar-fixed-bottom

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

三、響應(yīng)式

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

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

寬屏顯示:

 窄屏顯示:

 窄屏展開:

方法:

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

2.定義想要顯示的圖標(biāo),可以將其放在類名為“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" >首頁</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)簽添加一個class類名或id名,然后讓button的data-target鏈接到該元素:data-target=".class/#id"

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

路徑導(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>

樣式:

總結(jié)

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

相關(guān)文章

  • js實現(xiàn)簡單廣告小窗口

    js實現(xiàn)簡單廣告小窗口

    這篇文章主要為大家詳細(xì)介紹了js實現(xiàn)簡單廣告小窗口,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2021-09-09
  • 客戶端限制只能上傳jpg格式圖片的js代碼

    客戶端限制只能上傳jpg格式圖片的js代碼

    客戶端限制只能上傳jpg格式圖片的js代碼,對用戶體驗較好,適合網(wǎng)頁中只能使用jpg格式圖片的情況。
    2010-12-12
  • JavaScript讀取中文cookie時的亂碼問題的解決方法

    JavaScript讀取中文cookie時的亂碼問題的解決方法

    讀取中文cookie時出現(xiàn)亂碼,下面是具體的解決方法,大家以后使用過程中,盡量不要用中文。
    2009-10-10
  • Javascript中的delete介紹

    Javascript中的delete介紹

    關(guān)于JavaScript中的Delete一直沒有弄的很清楚,最近看到兩篇這方面的文章,現(xiàn)對兩文中部分內(nèi)容進行翻譯(內(nèi)容有修改和添加,順序不完全一致,有興趣推薦看原文),希望能對大家有所幫助
    2012-09-09
  • layui 彈出刪除確認(rèn)界面的實例

    layui 彈出刪除確認(rèn)界面的實例

    今天小編就為大家分享一篇layui 彈出刪除確認(rèn)界面的實例,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2019-09-09
  • JavaScript創(chuàng)建防篡改對象的方法分析

    JavaScript創(chuàng)建防篡改對象的方法分析

    這篇文章主要介紹了JavaScript創(chuàng)建防篡改對象的方法,結(jié)合具體實例形式分析了javascript基于不可擴展對象、密封的對象和凍結(jié)的對象實現(xiàn)防篡改對象的相關(guān)操作技巧,需要的朋友可以參考下
    2018-12-12
  • JavaScript中sharedWorker 實現(xiàn)多頁面通信的實例詳解

    JavaScript中sharedWorker 實現(xiàn)多頁面通信的實例詳解

    這篇文章主要介紹了JavaScript中sharedWorker 實現(xiàn)多頁面通信,通過給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2021-04-04
  • JS實現(xiàn)簡單控制視頻播放倍速的實例代碼

    JS實現(xiàn)簡單控制視頻播放倍速的實例代碼

    這篇文章主要介紹了通過JS來實現(xiàn)簡單控制視頻播放倍速,本文通過實例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2021-04-04
  • 用JavaScript和jQuery實現(xiàn)瀑布流

    用JavaScript和jQuery實現(xiàn)瀑布流

    本篇文章主要介紹了用JavaScript和jQuery實現(xiàn)瀑布流的方法,具有很好的參考價值。下面跟著小編一起來看下吧
    2017-03-03
  • 再談ie和firefox下的document.all屬性

    再談ie和firefox下的document.all屬性

    很多情況下,我們是使用document.all來判斷當(dāng)前瀏覽器是ie還是 Mozilla 。
    2009-10-10

最新評論