文章目录
前言
本篇文章主要是对Bootstrap CSS进行相应的总结,其中常用的就是图片、表格、文字排版、颜色等一些内容。同时对上篇文章缺失的的内容(偏移列)进行补充。
一、偏移列(补充)
1.概念:
偏移是一个用于更专业的布局的有用功能。它们可以用来给列腾出更多的空间。为了在大屏幕显示器上使用偏移,请使用.col-md-offset-*
类。这些类会把一个列的左边距(margin)增加*列,其中 * 范围是从1到11。注意:.col-xs-*类不支持偏移,解决的方法是通过使用一个空的单元格来实现该效果。
2.代码示例:
<div class = "container" style = "height: 200px; background-color: pink;">
<div class = "row">
<div class = "col-2" style = "height: 100px; background-color: red;">
第一列
</div>
<div class = "col-2 offset-1" style = "height: 100px; background-color: green;">第二列</div>
<div class = "col-2" style = "height: 100px; background-color: blue;">第三列</div>
</div>
</div>
二、图片
1.<img>
类:
类 | 描述 |
---|---|
.img-rounded | 添加border-radius:6px来获得图片圆角 |
.img-circle | 添加border-radius:50%来让整个图片变成圆形 |
.img-thumbnail | 添加一些内边距(padding)和一个灰色的边框 |
.img-responsive | 图片支持响应式(将很好的扩展到父元素)。将max-width:100%;和height:auto;样式应用在图片上 |
2.代码如下(示例):
<div class="container" >
<div class = "row">
<img src = "./img/1.jpg" width = "200" height="200" class = "rounded"/>
<img src = "./img/1.jpg" width = "200" height="200" class = "rounded-circle"/>
<img src = "./img/1.jpg" width = "200" height="200" class = "img-thumbnail"/>