Bootstrap3组件
Glyphicons
感谢Glyphicons的工作人员的慷慨, 允许BT的使用者免费使用添加一个有情连接http://glyphicons.com/
在需要用到字体图标的地方添加以下代码
<span class="glyphicon glyphicon-search"></span>
当然不要忘记图标和文本之前要添加一个空格 这样显示会更好
下拉菜单
<div class="dropdown">
<button type="button" class="btn btn-primary dropdown-toggle" id='drop1' data-toggle="dropdown">drop <span class="caret"></span></button>
<ul class="dropdown-menu" role="menu" aria-labelledby="drop1">
<li><a href="">asda</a></li>
<li><a href="">aaaa</a></li>
<li><a href="">wwww</a></li>
</ul>
</div>
这里需要注意的是给button 添加dropdown-toggle类 还要添加data-toggle属性为dropdown
按钮组
实现2边都是圆角然后中间按钮和2边的都是紧挨的
<div class="btn-group">
<button type="button" class="btn">11</button>
<button type="button" class="btn">22</button>
<button type="button" class="btn">33</button>
</div>
可以添加btn-group-lg 省去了给每一个按钮添加lg 这样整个按钮组都变大了
如果想让按钮不是水平排列而是垂直只要添加btn-group-vertical就OK了
导航
<ul class="nav nav-tabs" role="tablist">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">Profile</a></li>
<li><a href="#">Messages</a></li>
</ul>
标签页式的
更换成nav-pills 并添加nav-stacked 可以让导航变成垂直的 胶囊样式
导航条
navbar-fixed-top导航条固定在顶部
navbar-fixed-bottom固定在底部
这2个都需要你给body 添加margin 来覆盖掉默认的不然导航条会 遮盖主体内容
body { padding-top: 70px; }
下面引用BT官方文档里的一段代码来演示BT的导航条是可以响应式的导航条.当你在手机上浏览的时候导航条会被折叠 条目会在右侧的一个小图标中, 你点击图标会出来
静止在顶部navbar-static-top
反色navbar-inverse
当你屏幕宽度变小时候会发生这个情况
右侧的3横条 所有导航里的条目就隐藏在这里
<nav class="navbar navbar-default navbar-fixed-top navbar-inverse" role="navigation">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Brand</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Link</a>
</li>
<li><a href="#">Link</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Action</a>
</li>
<li><a href="#">Another action</a>
</li>
<li><a href="#">Something else here</a>
</li>
<li class="divider"></li>
<li><a href="#">Separated link</a>
</li>
<li class="divider"></li>
<li><a href="#">One more separated link</a>
</li>
</ul>
</li>
</ul>
<form class="navbar-form navbar-left" role="search">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
<ul class="nav navbar-nav navbar-right">
<li><a href="#">Link</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Action</a>
</li>
<li><a href="#">Another action</a>
</li>
<li><a href="#">Something else here</a>
</li>
<li class="divider"></li>
<li><a href="#">Separated link</a>
</li>
</ul>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
分页
<ul class="pagination">
<li><a href="">«</a></li>
<li><a href="">1</a></li>
<li><a href="">2</a></li>
<li><a href="">3</a></li>
<li><a href="">»</a></li>
</ul>
可以用pagination-lg pagination-sm来控制大小
巨幕
<div class="container">
<div class="jumbotron">
<h1>Hello CSDN</h1>
<p>This is a page for BT</p>
</div>
</div>
这主要用于主体部分展示主要展品 信息 较为醒目
警告框
<div class="alert alert-success alert-dismissible"><button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<strong>Warning!</strong> You finished the mission</div>
alert-dismissible 的意思是带有关闭按钮的警告框
进度条
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 60%;">
<span>60% Complete</span>
</div>
</div>
<div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 60%;">
<span>60% Complete</span>
</div>
</div>
<div class="progress">
<div class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 60%;">
<span>60% Complete</span>
</div>
</div>
<div class="progress">
<div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 60%;">
<span>60% Complete</span>
</div>
</div>
<div class="progress">
<div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 60%;">
<span>60% Complete</span>
</div>
</div>
带有不同颜色进度条 如果不想显示进度的数字可以给span添加sr-only类
想添加条纹效果得进度条 添加类progress-bar-striped
列表组
<div class="list-group">
<a href="" class="list-group-item active">home</a>
<a href="" class="list-group-item">contact</a>
<a href="" class="list-group-item">help</a>
<a href="" class="list-group-item">you</a>
</div>
可以给被禁用的条目添加 disabled