其实 Bootstrap 官方网站已经停止了对 2.3.2 版本的维护,不过由于不少的网站依然采用该部署方式,为了更好的维护现有的项目,我们依然还学习和了解旧版本的 Bootstrap 使用。
- 用 Container 来包围主要内容
Bootstrap 中涉及 Container 的代码如下:
.container {
margin-right: auto;
margin-left: auto;
*zoom: 1;
}
.container:before,
.container:after {
display: table;
line-height: 0;
content: "";
}
.container:after {
clear: both;
}
.container-fluid {
padding-right: 20px;
padding-left: 20px;
*zoom: 1;
}
.container-fluid:before,
.container-fluid:after {
display: table;
line-height: 0;
content: "";
}
.container-fluid:after {
clear: both;
}
我们可以看到这里有两种的 container,其中 container 是用于一般的部署的,而 container-fluid 用于自适应的部署方式。而在 Bootstrap 3.x 中 container 本身就已经完成了自适应的设置,这是两个版本中的一个区别。
- 待续...