bootstrap基础
bootstra里面的布局模式
固定布局 container
流动布局 container-fluid
<div class="container-fluid" style=" border: 1px solid black;height: 100px">
网格系统类似于table tr td
网格系统一行最大12列
row行
col--列
代表屏幕分辨率
sm 小 540px
md 中 720px
lg 大
xl
col-xl-auto根据内容自动分配
col--num 列 后面的代表跨几列
offset-1 设置marginleft值 8.333%
offset--2 不同的屏幕marginleft
invisible隐藏元素
visible显示元素
p-0 padding:0
p-1 padding:0.25rem;
p-2
pt
py
w-100 100%
w-75 75%
h-100 100%
h-50 50%
align-items-center 相对父容器垂直居中p-0
align-items-start 相对父容器顶部对齐
align-items-end 相对父容器底部对齐
align-content-center 考虑多行
align-self-center 自身在flexbox中的y轴分布
justify-content-center 子元素在父容器里面的x轴的排布情况
12个均分,大小一样
<div class="col-sm-1 col-lg-1 col-md-1 col-xl-1">1</div>
<div class="col-sm-1 col-lg-1 col-md-1 col-xl-1">2</div>
<div class="col-sm-1 col-lg-1 col-md-1 col-xl-1">3</div>
<div class="col-sm-1 col-lg-1 col-md-1 col-xl-1">4</div>
<div class="col-sm-1 col-lg-1 col-md-1 col-xl-1">5</div>
<div class="col-sm-1 col-lg-1 col-md-1 col-xl-1">6</div>
<div class="col-sm-1 col-lg-1 col-md-1 col-xl-1">7</div>
<div class="col-sm-1 col-lg-1 col-md-1 col-xl-1">8</div>
<div class="col-sm-1 col-lg-1 col-md-1 col-xl-1">9</div>
<div class="col-sm-1 col-lg-1 col-md-1 col-xl-1">10</div>
<div class="col-sm-1 col-lg-1 col-md-1 col-xl-1">11</div>
<div class="col-sm-1 col-lg-1 col-md-1 col-xl-1">12</div>
1 2 3 3:2:7
<div class="col-sm-2 col-lg-1 col-md-4 col-xl-3">1</div>
<div class="col-sm-8 col-lg-6 col-md-4 col-xl-2">2</div>
<div class="col-sm-2 col-lg-5 col-md-4 col-xl-7">3</div>
5个均分,大小一样
<div class="col">1</div>
<div class="col">2</div>
<div class="col">3</div>
<div class="col">4</div>
<div class="col">5</div>
pt-1 <div class="pt-1 col">1</div>
<div class="col">2</div>
<div class="col">3</div>
py-1 <div class="py-1 col">1</div>
<div class="col">2</div>
<div class="col">3</div>
w-100 <div class="w-100 col">1</div>
<div class="col">2</div>
<div class="col">3</div>
h-100 <div class="h-100 col">1</div>
<div class="col">2</div>
<div class="col">3</div>
1 2 3 连起来居中竖直
<div class="row align-content-center" style="border: 1px solid red; height: 300px">
<div class="col-lg-1 " style="height: 60px; border: 1px solid black">1</div>
<div class="w-100"></div>
<div class="col-lg-1" style="height: 60px; border: 1px solid black">2</div>
<div class="w-100"></div>
<div class="col-lg-1" style="height: 60px; border: 1px solid black">3</div>
</div>
1居中 2 3
<div class="row" style="border: 1px solid red; height: 300px">
<div class="col-lg-1 align-self-center" style="height: 60px; border: 1px solid black">1</div>
<div class="col-lg-1 align-self-end" style="height: 60px; border: 1px solid black">2</div>
<div class="col-lg-1" style="height: 60px; border: 1px solid black">3</div>
</div>
123接起来居中 水平
<div class="row justify-content-center" style="border: 1px solid red; height: 300px">
<div class="col-lg-1" style="height: 60px; border: 1px solid black">1</div>
<div class="col-lg-1" style="height: 60px; border: 1px solid black">2</div>
<div class="col-lg-1" style="height: 60px; border: 1px solid black">3</div>
</div>
媒体查询
@media (min-width: 576px) {
.block{
width: 560px;
}
}
@media (min-width: 768px) {
.block{
width: 750px;
}
}
@media (min-width: 992px) {
.block{
width: 980px;
}
}
@media (min-width: 1200px) {
.block{
width: 1140px;
}
}
min-width要从小到大
@media (max-width: 1200px) {
.block{
width: 1140px;
}
}
@media (max-width: 992px) {
.block{
width: 980px;
}
}
@media (max-width: 768px) {
.block{
width: 750px;
}
}
@media (max-width: 576px) {
.block{
width: 560px;
}
}
max-width要从大到小
@media (max-width: 1200px) and (min-width: 993px) {
.block{
width: 1140px;
}
}
@media (max-width: 992px) and (min-width: 769px) {
.block{
width: 980px;
}
}
@media (max-width: 768px) and (min-width: 577px) {
.block{
width: 750px;
}
}
@media (max-width: 576px) {
.block{
width: 560px;
}
}
元素浮动根据分辨率去选择
float-left左浮动
float-right右浮动
text-center 水平居中 left right justify sm xl md lg
<div class="row text-warning">
bootstrap
</div>
<div>
<span class="h2">bootstrap</span> 大小不同
<span class="h3">bootstrap</span>
<span class="h4">bootstrap</span>
<span class="h5">bootstrap</span>
<span class="small">bootstrap</span> small是正常大小的80%
<span class="close">×</span> 关闭特效 鼠标有点击效果 已经做好的
</div>
<ul class="list-inline">
<li>bootstrap</li>
<li>bootstrap</li> 竖着排列
<li>bootstrap</li>
<li>bootstrap</li>
<li>bootstrap</li>
</ul>
<ul>
<li class="list-inline-item">bootstrap</li>
<li class="list-inline-item">bootstrap</li> 横着排列
<li class="list-inline-item">bootstrap</li>
<li class="list-inline-item">bootstrap</li>
<li class="list-inline-item">bootstrap</li>
</ul>
图片响应式 img-fluid max-width:100% img-thumbnail 图片外边框加圆角
<div class="col-lg-1 float-left"><img class="img-fluid rounded " src="./img/1.jpg" alt=""/></div>
<div class="col-lg-1 float-right"><img class="img-fluid rounded " src="./img/1.jpg" alt=""/></div>
rounded
一些颜色属性
table-primary table-danger table-success table-dark table-lighttable-info table-secondary
<table class="table table-hover table-bordered table-striped">
<tr class="table-active ">
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
</table>
响应式图片比父容器大
code颜色字体
kbd黑底白色
samp加粗的样子
img-thumbnail圆角
mx-aoto左右
组件alert alert-success alert-dismissible
<button>
提示框动画
胶囊形状
进度条
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。