本文只摘取部分内容,全部内容请查看官网
在使用Bootstrap的时候所有的样式都只需要通过class来调解。
Bootstrap网址:https://www.bootcss.com/
咱们遵循不使用最新版本,因此选择V3版本:https://v3.bootcss.com/
Bootstrap 是最受欢迎的 HTML、CSS 和 JS 框架,用于开发响应式布局、移动设备优先的 WEB 项目。
注意点:
Bootstrap的js代码是依赖于jQuery的,所以在使用Bootstrap的动态效果的时候,必须先导入jQuery。
布局容器:
<body>
<div class="container ">左右两边有留白</div>
<div class="container-fluid ">左右两边没有留白</div>
</body>
后续在用bootstrap写页面的时候就可以上来就写一个div class=”container”,之后在div内部书写代码。
栅格系统:
<body>
<div class="container ">左右两边有留白
<div class="row" >row为行,分为12份,并且row可以进行嵌套操作
<div class="col-md-6 "></div>
<div class="col-md-6 "></div>
</div>
</div>
<div class="container-fluid ">左右两边没有留白</div>
在使用bootstrap框架的时候记住12的加减法
栅格参数:
.col-xs- 手机
.col-sm- 平板
.col-md- 桌面
.col-lg- 大桌面
针对不同的显示器,bootstrap会自动选择参数
列偏移:
.col-md-offset-4 从左往右移动4列
版:
bootstrap内将很多样式已经提前封装好了人肉眼能接受的样式,具体查看官方文档。
表格
.table 为表格赋予基本的表格样式
.table-striped 给 <tbody> 之内的每一行增加斑马条纹样式。
.table-bordered 为表格和其中的每个单元格增加边框。
.table-hover 让 <tbody> 中的每一行对鼠标悬停状态作出响应。
.table-condensed 让表格更加紧凑,单元格中的内补(padding)均会减半。
<table class="table table-hover table-bordered table-striped table-condensed"></table>
.active 鼠标悬停在行或单元格上时所设置的颜色
.success 标识成功或积极的动作
.info 标识普通的提示信息或动作
.warning 标识警告或需要用户注意
.danger 标识危险或潜在的带来负面影响的动作
<!-- On rows -->
<tr class="active">...</tr>
<tr class="success">...</tr>
<tr class="warning">...</tr>
<tr class="danger">...</tr>
<tr class="info">...</tr>
<!-- On cells (`td` or `th`) -->
<tr>
<td class="active">...</td>
<td class="success">...</td>
<td class="warning">...</td>
<td class="danger">...</td>
<td class="info">...</td>
</tr>
响应式表格:
会在小屏幕设备上(小于768px)水平滚动。当屏幕大于 768px 宽度时,水平滚动条消失。
<div class="table-responsive">
<table class="table"></table>
</div>
表单
单独的表单控件会被自动赋予一些全局样式。所有设置了 .form-control 类的 、