2015-09-26 46 views
0

當調整窗口大小以使某些組件不再適合同一行時,它們被推送到下一行,但帶有偏移量。我該如何擺脫?引導程序:自動排列無偏移的組件

<div class="checkbox-inline"> 
    <label> 
     <input type="checkbox"> Check me out 
    </label> 
    </div> <div class="checkbox-inline"> 
    <label> 
     <input type="checkbox"> Check me out 
    </label> 
    </div> 

enter image description here

enter image description here

只是爲了澄清,我喜歡的行爲,事情是這樣的,我只是想擺脫那個偏移。

回答

2

如果你看一看到bootstrap.css,那麼你會看到下面幾行:

.checkbox-inline + .checkbox-inline, .radio-inline + .radio-inline { 
    margin-left: 10px; 
    margin-top: 0; 
} 

最重要的事情是「+」 - 運營商。

.checkbox-inline + .checkbox-inline 

這意味着,隨後直接在另一「.checkbox內聯‘ - 元素每一個’.checkbox內聯」 - 元素,將有10px的其左側的餘量。

所以一個可能的解決方案可能是操縱的CSS文件。但另一件事,你可以做的是在複選框之間添加空的「span」元素。

<div class="checkbox-inline"> 
    <input type="checkbox"><label>Check me out</label> 
</div> 
<span></span> 
<div class="checkbox-inline"> 
    <input type="checkbox"><label>Check me out</label> 
</div> 

我希望,這是有幫助的。