小图标
类名:
glyphicon glyphicon-样式
样式:
通过CSS设置字体大小和颜色设置
示例:
<!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.0">
<title>Document</title>
<link rel="stylesheet" href="bootstrap-3.4.1-dist/css/bootstrap.css">
<style>
span:nth-child(2) {
color: red;
font-size: 40px;
}
</style>
</head>
<body>
<span class="glyphicon glyphicon-home"></span>
<span class="glyphicon glyphicon-phone"></span>
</body>
</html>
样式如下
按钮组
类名
btn-group
示例:
<!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.0">
<title>Document</title>
<link rel="stylesheet" href="bootstrap-3.4.1-dist/css/bootstrap.css">
</head>
<body>
<!-- 普通按钮 -->
<button class="btn btn-default">按钮1</button>
<button class="btn btn-info">按钮2</button>
<button class="btn btn-primary">按钮3</button>
</br>
</br>
</br>
<!-- 按钮组 -->
<div class="btn-group">
<button class="btn btn-default">按钮1</button>
<button class="btn btn-info">按钮2</button>
<button class="btn btn-primary">按钮3</button>
</div>
</body>
</html>
样式如下:
输入框组
类名
目标 | 格式布局类名 |
---|---|
div(父元素) | input-group |
span | input-group-addon |
input | form-control |
button | input-group-btn |
类名
目标 | 样式类名 |
---|---|
div(父元素) | input-group-lg |
div(父元素) | input-group-sm |
示例
<!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.0">
<title>Document</title>
<link rel="stylesheet" href="bootstrap-3.4.1-dist/css/bootstrap.css">
</head>
<body>
<div class="input-group col-xs-5">
<input type="text" class="form-control">
<span class="input-group-btn">
<button class="btn btn-warning ">按钮</button>
</span>
</div>
</body>
</html>
样式如下
下拉菜单
类名
目标 | 类名/属性高 |
---|---|
div(父元素) | dropdown/dropup/btn-group |
点击的部分 | data-toggle="dropdown"caret(向下箭头) |
下拉菜单项 | dropdown-menuactive(默认选中)divider(分割线) |
示例
<!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.0">
<title>Document</title>
<link rel="stylesheet" href="bootstrap-3.4.1-dist/css/bootstrap.css">
</head>
<body>
<div class="btn-group">
<button class="btn btn-primary">下拉菜单</button>
<button class="btn btn-primary" data-toggle="dropdown"><span class="caret"></span></button>
<ul class="dropdown-menu">
<li class="active">1</li>
<li>2</li>
<li>3</li>
</ul>
</div>
</body>
</html>
<script src="/jquery-3.6.0.min.js"></script>
<script src="/bootstrap-3.4.1-dist/js/bootstrap.js"></script>
样式如下
导航和导航条
1.导航(ul>li>a)
选项卡式
类名:nav nav-tabs
胶囊式
类名:nav nav-pills
标签自适应宽度
类名:nav nav-tabs/pills nav-justified
二级导航
嵌套下拉菜单
示例
<!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.0">
<title>Document</title>
<link rel="stylesheet" href="bootstrap-3.4.1-dist/css/bootstrap.css">
</head>
<body>
<ul class="nav nav-tabs">
<li class="active"><a href="">选项一</a></li>
<li><a href="">选项二</a></li>
<li><a href="">选项三</a></li>
</ul>
<br>
<br>
<ul class="nav nav-tabs nav-justified">
<li class="active"><a href="">选项一</a></li>
<li><a href="">选项二</a></li>
<li><a href="">选项三</a></li>
</ul>
<br>
<br>
<ul class="nav nav-pills">
<li class="active"><a href="">选项一</a></li>
<li><a href="">选项二</a></li>
<li><a href="">选项三</a></li>
</ul>
</body>
</html>
样式如下
2.导航条(div>div/ul>li>a)
div
系统样式:navbar navbar-default
反色样式:navbar navbar-inverse
固定定位:navbar-fixed-top/navbar-fixed-bottom
定位随滚动条滑动:navbar-static-top/navbar-static-bottom
div>div
1.图片头部;
2.文字头部:navbar-header
2-1:div>div>a:navbar-brand
div>ul(导航条内导航)
navbar navbar-nav
div>文本
navbar-text
div>链接
navbar-link
div>表单
navbar-form
div>按钮
navbar-btn
导航条内元素对齐方式
navbar-left
navbar-right
pull-right
3.响应式导航条
缩小后小按钮
类:navbar-toggle
属性:data-toggle=“collapse”;data-target="#/."
缩小后隐藏部分
类:collapse navbar-collapse
id/class
缩略图
类名:
thumbail
内容:
1.图片
2.文字:caption
注意
可配合12栅格系统使用
示例
<!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.0">
<title>Document</title>
<link rel="stylesheet" href="bootstrap-3.4.1-dist/css/bootstrap.css">
</head>
<body>
<div class="thumbnail col-xs-4">
<img src="/img/1.jpg" alt="">
<div class="caption">
<p>缩略图1</p>
</div>
</div>
<div class="thumbnail col-xs-4">
<img src="/img/2.jpg" alt="">
<div class="caption">
<p>缩略图2</p>
</div>
</div>
<div class="thumbnail col-xs-4">
<img src="/img/3.jpg" alt="">
<div class="caption">
<p>缩略图3</p>
</div>
</div>
</body>
</html>
样式如下
媒体对象
类名
目标 | 类名 |
---|---|
div(父元素) | media |
div(头部) | media-left/media-right |
div(头部)-img | media-object |
div(文字部分) | media-body |
div(文字部分)-标题 | media-heading |
注意
还可配合12栅格使用
示例
<!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.0">
<title>Document</title>
<link rel="stylesheet" href="bootstrap-3.4.1-dist/css/bootstrap.css">
</head>
<body>
<div class="media">
<div class="media-left">
<img src="/img/1.jpg" class="media-object">
</div>
<div class="media-body">
<h3 class="media-heading">标题</h3>
<p>正文</p>
</div>
</div>
<div class="media">
<div class="media-body text-right">
<h3 class="media-heading">标题</h3>
<p>正文</p>
</div>
<div class="media-right">
<img src="/img/2.jpg" class="media-object">
</div>
</div>
</body>
</html>
<script src="/jquery-3.6.0.min.js"></script>
<script src="/bootstrap-3.4.1-dist/js/bootstrap.js"></script>
样式如下
列表组
类名
目标 | 类名 |
---|---|
ul | list-group |
li | list-group-item |
li | list-group-item-danger(红色)/list-group-item-info(浅蓝色)… |
li | list-group-item-heading |
li>span | badge |
注意
还可配合12栅格使用
示例
<!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.0">
<title>Document</title>
<link rel="stylesheet" href="bootstrap-3.4.1-dist/css/bootstrap.css">
</head>
<body>
<ul class="list-group col-xs-6">
<li class="list-group-item active list-group-item-heading">
第一个
</li>
<li class="list-group-item">
第二个
</li>
<li class="list-group-item list-group-item-success">
第三个
</li>
<li class="list-group-item list-group-item-info">
第四个
<span class="badge">1</span>
</li>
</ul>
</body>
</html>
<script src="/jquery-3.6.0.min.js"></script>
<script src="/bootstrap-3.4.1-dist/js/bootstrap.js"></script>
样式如下
分页导航(ul>li>a)
分页
类名
ul:pagination
翻页
普通模式类名
ul:pager
分散模式类名
ul:pager
上一页li:previous
下一页li:next
li通用样式
禁用:disabled
默认选中:active
示例
<!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.0">
<title>Document</title>
<link rel="stylesheet" href="bootstrap-3.4.1-dist/css/bootstrap.css">
</head>
<body>
<ul class="pagination">
<li class="disabled"><a href="#">首页</a></li>
<li class="active"><a href="#">1</a></li>
<li><a href="#">2</a></li>
<li><a href="#">3</a></li>
<li><a href="#">最后一页</a></li>
</ul>
<ul class="pager">
<li><a href="#">上一页</a></li>
<li><a href="#">下一页</a></li>
</ul>
<ul class="pager">
<li class="previous"><a href="#">上一页</a></li>
<li class="next"><a href="#">下一页</a></li>
</ul>
</body>
</html>
<script src="/jquery-3.6.0.min.js"></script>
<script src="/bootstrap-3.4.1-dist/js/bootstrap.js"></script>
样式如下
今天的分享就是这些啦,欢迎正在学习web的伙伴们“挑毛病”“提意见”,当然了也欢迎各种表扬奥~(比心,比心)