bl双性强迫侵犯h_国产在线观看人成激情视频_蜜芽188_被诱拐的少孩全彩啪啪漫画

bootstrap怎么讓dropdownmenu按鈕式下拉框長度一致

這篇文章主要介紹bootstrap怎么讓dropdown menu按鈕式下拉框長度一致,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!

創(chuàng)新互聯主要從事網站制作、成都網站制作、網頁設計、企業(yè)做網站、公司建網站等業(yè)務。立足成都服務醴陵,10多年網站建設經驗,價格優(yōu)惠、服務專業(yè),歡迎來電咨詢建站服務:18982081108

bootstrap框架提供了下拉菜單組件(dropdown),即點擊一個元素或按鈕,觸發(fā)隱藏的列表顯示出來。

1、基本代碼和頁面展示

按鈕和菜單需要包裹在.dropdown 的容器里,而作為被點擊的元素按鈕需要設置

data-toggle="dropdown"才能有效。對于菜單部分,設置 class="dropdown-menu"才能

自動隱藏并添加固定樣式。設置 class="caret"表示箭頭,可上可下。

<div class="dropdown"> 
<button class="btn btn-default" data-toggle="dropdown"> 
下拉菜單 
<span class="caret"></span> 
</button> 
<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" >首頁</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" >資訊</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" >產品</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" >關于</a></li> 
</ul> 
</div>

bootstrap怎么讓dropdown menu按鈕式下拉框長度一致

2、使用進階和dropdown-menu長度問題

在解決這個問題之前,先記錄bootstrap的按鈕組功能(btn-group),可以將一組按鈕集成在一個容器里,且相互之前沒有間隔。直接貼代碼和顯示效果。

<span > </span><div class="btn-group"> 
 <button type="button" class="btn btn-default">上一頁</button> 
 <button type="button" class="btn btn-default">下一頁</button> 
 <button type="button" class="btn btn-default">選擇頁數</button> 
 <div class="btn-group"> 
  <button class="btn btn-default dropdown-toggle" data-toggle="dropdown">下拉框 
  <i class="caret"></i> 
  </button> 
  <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" >首頁</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" >首頁</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" >首頁</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" >首頁</a></li> 
  </ul> 
 </div> 
 </div>

bootstrap怎么讓dropdown menu按鈕式下拉框長度一致

代碼解析與總結:

首先嵌套了<div class="btn-group">容器,用于在按鈕組中使用按鈕式下拉框,

<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<span >中的dropdown-toggle的作用是讓按鈕式下拉框的也擁有btn-group的圓邊角。</span>
<i class="caret">
</i>
<span >三角圖標,使用<span>也可以。
</span>

data-toggle="dropdown"是html5的標簽屬性,指以什么事件觸發(fā),常用的如:modal,popover,tooltips。這里指該button按鈕用于下拉按鈕。并且親測在html4中使用該屬性,雖然IDE會發(fā)出警告,但是仍然可以實際運行,此特性作用于html5的其他新屬性,如input標簽的placeholder。

<ul class="dropdown-menu" > min-width:100%屬性用于將下拉框長度與按鈕長度保持一致,因為bootstrap并沒有設置這一點。原始效果如下: 

bootstrap怎么讓dropdown menu按鈕式下拉框長度一致

以上是“bootstrap怎么讓dropdown menu按鈕式下拉框長度一致”這篇文章的所有內容,感謝各位的閱讀!希望分享的內容對大家有幫助,更多相關知識,歡迎關注創(chuàng)新互聯行業(yè)資訊頻道!

當前名稱:bootstrap怎么讓dropdownmenu按鈕式下拉框長度一致
標題URL:http://vcdvsql.cn/article24/pdhjce.html

成都網站建設公司_創(chuàng)新互聯,為您提供定制網站ChatGPT網頁設計公司網站建設服務器托管

廣告

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

網站建設網站維護公司