中文字幕一区二区人妻电影,亚洲av无码一区二区乱子伦as ,亚洲精品无码永久在线观看,亚洲成aⅴ人片久青草影院按摩,亚洲黑人巨大videos

Bootstrap 輔助類

本章節(jié)將討論 Bootstrap 中的一些可能會派上用場的輔助類。

文本

以下不同的類展示了不同的文本顏色。如果文本是個(gè)鏈接鼠標(biāo)移動到文本上會變暗:

描述 實(shí)例
.text-muted "text-muted" 類的文本樣式 運(yùn)行代碼
.text-primary "text-primary" 類的文本樣式 運(yùn)行代碼
.text-success "text-success" 類的文本樣式 運(yùn)行代碼
.text-info "text-info" 類的文本樣式 運(yùn)行代碼
.text-warning "text-warning" 類的文本樣式 運(yùn)行代碼
.text-danger "text-danger" 類的文本樣式 運(yùn)行代碼

背景

以下不同的類展示了不同的背景顏色。 如果文本是個(gè)鏈接鼠標(biāo)移動到文本上會變暗:

描述 實(shí)例
.bg-primary 表格單元格使用了 "bg-primary" 類 運(yùn)行代碼
.bg-success 表格單元格使用了 "bg-success" 類 運(yùn)行代碼
.bg-info 表格單元格使用了 "bg-info" 類 運(yùn)行代碼
.bg-warning 表格單元格使用了 "bg-warning" 類 運(yùn)行代碼
.bg-danger 表格單元格使用了 "bg-danger" 類 運(yùn)行代碼

其他

描述 實(shí)例
.pull-left 元素浮動到左邊 運(yùn)行代碼
.pull-right 元素浮動到右邊 運(yùn)行代碼
.center-block 設(shè)置元素為 display:block 并居中顯示 運(yùn)行代碼
.clearfix 清除浮動 運(yùn)行代碼
.show 強(qiáng)制元素顯示 運(yùn)行代碼
.hidden 強(qiáng)制元素隱藏 運(yùn)行代碼
.sr-only 除了屏幕閱讀器外,其他設(shè)備上隱藏元素 運(yùn)行代碼
.sr-only-focusable 與 .sr-only 類結(jié)合使用,在元素獲取焦點(diǎn)時(shí)顯示(如:鍵盤操作的用戶) 運(yùn)行代碼
.text-hide 將頁面元素所包含的文本內(nèi)容替換為背景圖 運(yùn)行代碼
.close 顯示關(guān)閉按鈕 運(yùn)行代碼
.caret 顯示下拉式功能 運(yùn)行代碼

更多實(shí)例

關(guān)閉圖標(biāo)

使用通用的關(guān)閉圖標(biāo)來關(guān)閉模態(tài)框和警告框。使用 class close 得到關(guān)閉圖標(biāo)。

實(shí)例

<p>關(guān)閉圖標(biāo)實(shí)例 <button type="button" class="close" aria-hidden="true"> &times; </button> </p>

運(yùn)行代碼 ?

結(jié)果如下所示:

關(guān)閉圖標(biāo)

aria-hidden="true" 主要是幫助殘障人士(如失明)使用識讀設(shè)備(自動讀取內(nèi)容并自動播放出來),播放到帶此屬性的內(nèi)容時(shí)會自動跳過,以免殘障人士混淆!

插入符

使用插入符表示下拉功能和方向。使用帶有 class caret 的 <span> 元素得到該功能。

實(shí)例

<p>插入符實(shí)例 <span class="caret"></span> </p>

運(yùn)行代碼 ?

結(jié)果如下所示:

插入符

快速浮動

您可以分別使用 class pull-leftpull-right 來把元素向左或向右浮動。下面的實(shí)例演示了這點(diǎn)。

實(shí)例

<div class="pull-left"> 向左快速浮動 </div> <div class="pull-right"> 向右快速浮動 </div>

運(yùn)行代碼 ?

結(jié)果如下所示:

快速浮動

如需對齊導(dǎo)航欄中的組件,請使用 .navbar-left.navbar-right 代替。請查看 Bootstrap 導(dǎo)航欄

內(nèi)容居中

使用 class center-block 來居中元素。

實(shí)例

<div class="row"> <div class="center-block" style="width:200px;background-color:#ccc;"> 這是 center-block 實(shí)例 </div> </div>

運(yùn)行代碼 ?

結(jié)果如下所示:

居中內(nèi)容塊

清除浮動

如需清除元素的浮動,請使用 .clearfix class。

實(shí)例

<div class="clearfix" style="background: #D8D8D8;border: 1px solid #000;padding: 10px;"> <div class="pull-left" style="background:#58D3F7;"> 向左快速浮動 </div> <div class="pull-right" style="background: #DA81F5;"> 向右快速浮動 </div> </div>

運(yùn)行代碼 ?

結(jié)果如下所示:

清除浮動

顯示和隱藏內(nèi)容

您可以通過使用 class .show.hidden 來強(qiáng)行設(shè)置元素顯示或隱藏(包括屏幕閱讀器)。

實(shí)例

<div class="row" style="padding: 91px 100px 19px 50px;"> <div class="show" style="margin-left:10px;width:300px;background-color:#ccc;"> 這是 show class 的實(shí)例 </div> <div class="hidden" style="width:200px;background-color:#ccc;"> 這是 hide class 的實(shí)例 </div> </div>

運(yùn)行代碼 ?

結(jié)果如下所示:

顯示和隱藏內(nèi)容

屏幕閱讀器

您可以通過使用 class .sr-only 來把元素對所有設(shè)備隱藏,除了屏幕閱讀器。

實(shí)例

<div class="row" style="padding: 91px 100px 19px 50px;"> <form class="form-inline" role="form"> <div class="form-group"> <label class="sr-only" for="email">Email 地址</label> <input type="email" class="form-control" placeholder="Enter email"> </div> <div class="form-group"> <label class="sr-only" for="pass">密碼</label> <input type="password" class="form-control" placeholder="Password"> </div> </form> </div>

運(yùn)行代碼 ?

結(jié)果如下所示:

屏幕閱讀器

在這里,我們看到兩個(gè) input 類型的 label 標(biāo)簽都帶有 class sr-only,因此標(biāo)簽將只對屏幕閱讀器可見。