对于Bootstrap 3.0或更高版本,
see this answer
我们只看着类.span1这里(一个12格的网格上的一列),但你可以通过删除左边距来实现你想要的:
.row-fluid [class*="span"] { margin:0 } // line 571 of bootstrap responsive
然后将.row-fluid .span1的宽度更改为等于100%除以12列(8.3333%)。
.row-fluid .span1 { width: 8.33334% } // line 632 of bootstrap responsive
您可能希望通过添加一个额外的类来实现此目的,这将允许您保持基本网格系统的完整性:
.row-fluid [class*="NoGutter"] { margin-left:0 }
.row-fluid .span1NoGutter { width: 8.33334% }
您可以为所有其他列重复此模式:
.row-fluid .span2NoGutter { width:16.66667%; margin-left:0 } // 100% / 6 col
.row-fluid .span4NoGutter { width:25%; margin-left:0 } // 100% / 4 col
.row-fluid .span3NoGutter { width:33.33333%; margin-left:0 } // 100% / 3 col
or
.row-fluid .span4NoGutter { width:25% }
.row-fluid [class*="NoGutter"] { margin-left:0 }
*编辑(坚持使用默认网格)
如果默认网格系统是一个要求,它默认宽度为940px(.container和.span12类);因此,在最简单的术语中,您需要将940除以12.这相当于12个78.33333像素宽的容器。
所以bootstrap.css的第339行可以这样编辑:
.span1 { width:78.33333px; margin-left:0 }
or
.span1 { width:8.33334%; margin-left:0 }
// this should render at 78.333396px (78.333396 x 12 = 940.000752)