2014-09-19 58 views
0

我一直在觸及一個我不相信的區域,該區域在bootstrap文檔中被添加到引導程序中。Bootstrap 3.2 Col Margins

爲了解決這個問題,我使用了下面的代碼,但問題是中心框總是比外面的兩個小。

有沒有人有解決這個問題? enter image description here

HTML

​​

CSS

.marginBoxes { 
    margin-left: 20px; 
    margin-right: 20px; 
} 
.noMarginLeft{ 
    margin-left:0 !important; 
} 
.noMarginRight{ 
    margin-right:0 !important; 

} 

Live Preview

+1

獲取源,開拓'variables.less'和改變'@網溝width'變量 – Luke 2014-09-19 09:07:11

+0

你能解釋一下嗎? – Brent 2014-09-19 09:08:48

+0

如果您不想使用'less'(正如@Doctus建議的那樣),那麼請訪問http://getbootstrap.com/customize,將@ grid-gutter-width從30px更改爲您的選擇並下載文件。 – DavidG 2014-09-19 09:10:07

回答

3

正如意見建議,我會離開靴單獨的陷阱,使箱分離,可能沿着這些路線的東西:

#lightBlueFix { background-color: blue; } 
 
#lightGrey { background-color: grey; } 
 
#lightYellow { background-color: yellow; } 
 

 
.bannerBox { 
 
    margin-left: 20px; 
 
    margin-right: 20px; 
 
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> 
 
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css"> 
 
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> 
 

 
<div class="row"> 
 
    <div class="col-lg-4"> 
 
    \t <div id="lightBlueFix" class="bannerBox"> 
 
      Blue 
 
     </div> 
 
    </div> 
 
    <div class="col-lg-4"> 
 
     <div id="lightGrey" class="bannerBox"> 
 
      Grey 
 
     </div> 
 
    </div> 
 
    <div class="col-lg-4"> 
 
     <div id="lightYellow" class="bannerBox"> 
 
      Yellow 
 
     </div> 
 
    </div>  
 
</div>