我遵循了计算宽度的引导方法,并提出了以下建议。您将需要遵循以下 HTML 结构:
<div class="row-fluid-5">
<div class="span2">Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum</div>
<div class="span2">Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum</div>
<div class="span2">Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum</div>
<div class="span2">Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum</div>
<div class="span2">Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum</div>
</div>
然后,在您加载 bootstrap.css 和 bootstrap-responsive.css 后,使用以下内容加载您的 custom.css 文件:
/* CUSTOM 5 COLUMN SPAN LAYOUT
*
* based on http://gridcalculator.dk/
* width => 1200, gutter => 15px, margin => 15px, columns => 5
*/
.row-fluid-5 {
width: 100%;
*zoom: 1;
}
.row-fluid-5:before,
.row-fluid-5:after {
display: table;
line-height: 0;
content: "";
}
.row-fluid-5:after {
clear: both;
}
.row-fluid-5 [class*="span"] {
display: block;
float: left;
width: 100%;
min-height: 30px;
margin-left: 1.875%;
*margin-left: 1.875%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.row-fluid-5 .controls-row [class*="span"] + [class*="span"] {
margin-left: 1.875%;
}
.row-fluid-5 [class*="span"]:first-child{
margin-left: 0;
}
.row-fluid-5 .span2 {
width: 18.5%;
*width: 18.5%;
}
/* responsive ONLY */
@media (max-width: 600px){ /* spans reduce to 100px then go full width */
.row-fluid-5 [class*="span"]{
margin-left: 0;
float: left;
width: 100%;
padding: 10px;
}
}
查看下面的演示以了解它是如何工作的。
演示