- 相關(guān)推薦
如何簡(jiǎn)單實(shí)現(xiàn)bootstrap選項(xiàng)卡效果
導(dǎo)語(yǔ):如何簡(jiǎn)單實(shí)現(xiàn)bootstrap選項(xiàng)卡效果,下面是小編給大家推薦的代碼實(shí)現(xiàn)過(guò)程,大家可以參考閱讀,更多詳情請(qǐng)關(guān)注應(yīng)屆畢業(yè)生考試網(wǎng)。
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap</title>
<link rel="stylesheet" href="css/bootstrap.css" rel="external nofollow" />
<style>
.tab1{
border:1px solid #ddd;
border-top:none;
padding:30px;
border-radius:0 0 5px 5px;/*把邊框變?yōu)閳A角:top-left、top-right、bottom-right、bottom-left*/
}
</style>
</head>
<body>
<!--1.導(dǎo)航對(duì)應(yīng)的所有內(nèi)容要放到一個(gè)class為tab-content的p里;
2.每一個(gè)內(nèi)容塊兒都要加上一個(gè)名為tab-pane的class,并且給對(duì)應(yīng)的默認(rèn)顯示的內(nèi)容添加一個(gè)active的class;
3.給每一個(gè)導(dǎo)航的a標(biāo)簽添加一個(gè)data-toggle="tab"的自定義屬性;
4.給每一個(gè)選項(xiàng)內(nèi)容添加一個(gè)id;
5.給每一個(gè)導(dǎo)航的a標(biāo)簽添加一個(gè)錨點(diǎn),即在#號(hào)后加上對(duì)應(yīng)內(nèi)容的id-->
<p class="container">
<p class="row">
<ul class="nav nav-tabs">
<li><a href="#con1" rel="external nofollow" data-toggle="tab">蘋果</a></li>
<li><a href="#con2" rel="external nofollow" data-toggle="tab">香蕉</a></li>
<li><a href="#con3" rel="external nofollow" data-toggle="tab">橘子</a></li>
</ul>
<p class="tab-content"><!--選項(xiàng)卡的內(nèi)容-->
<p id="con1" class="tab-pane">html</p>
<p id="con2" class="tab-pane">css</p>
<p id="con3" class="tab-pane">javascript</p>
</p>
</p>
<p class="row">
<p class="col-lg-4"><!--讓導(dǎo)航欄只占4個(gè)格子-->
<ul class="nav nav-tabs">
<li><a href="#con4" rel="external nofollow" data-toggle="tab">蘋果</a></li>
<li><a href="#con5" rel="external nofollow" data-toggle="tab">香蕉</a></li>
<li><a href="#con6" rel="external nofollow" data-toggle="tab">橘子</a></li>
</ul>
<p class="tab-content tab1"><!--選項(xiàng)卡的內(nèi)容-->
<p id="con4" class="tab-pane">html</p>
<p id="con5" class="tab-pane">css</p>
<p id="con6" class="tab-pane">javascript</p>
</p>
</p>
</p>
</p>
<script src="js/jquery-2.1.0.js"></script>
<script src="js/bootstrap.js"></script>
</body>
</html>
效果圖:
【如何簡(jiǎn)單實(shí)現(xiàn)bootstrap選項(xiàng)卡效果】相關(guān)文章:
BootStrap select2 如何實(shí)現(xiàn)動(dòng)態(tài)改變值09-22
如何實(shí)現(xiàn)bootstrap jquery dataTable異步ajax刷新表格數(shù)據(jù)09-26
如何使用javascript實(shí)現(xiàn)瀑布流及效果加載06-17
電影海報(bào)冰霜字體效果是如何實(shí)現(xiàn)的07-28
如何實(shí)現(xiàn)JavaScript的DIV塊來(lái)回滾動(dòng)效果06-30
如何實(shí)現(xiàn)照片甜美清新效果的制作09-05
CSS3實(shí)現(xiàn)選項(xiàng)卡切換的方法08-05