其实 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 本身就已经完成了自适应的设置,这是两个版本中的一个区别。
- 待续...
本文详细介绍了Bootstrap 2.3.2版本中Container和Container-fluid的使用方法及其区别。Container用于固定宽度布局,而Container-fluid用于自适应布局。在Bootstrap 3.x中,Container已具备自适应特性。

被折叠的 条评论
为什么被折叠?



