我遇到了一種情況,我要求不要限制連續的列數,因爲可能會將多個內容塊從管理員的地方添加到該區域。Bootstrap 3 - 連續超過12列
默認情況下,BS3的行爲告訴12列div不要浮動,這會導致它們越過較小的浮動div頂部。所以我寫了一個覆蓋作爲我的系統的類,並認爲我會分享以防其他人遇到問題。
如果任何人有更好的主意或建議,我會喜歡覺得我不是黑客Bootstrap ...但這是我如何解決它。
/* col-xs float fix for large column groups */
.large-group .col-xs-12 {
float: left;
}
/* col-sm float fix for large column groups */
@media (min-width: 768px) {
.large-group .col-sm-12 {
float: left;
}
}
/* col-md float fix for large column groups */
@media (min-width: 992px) {
.large-group .col-md-12 {
float: left;
}
}
/* col-lg float fix for large column groups */
@media (min-width: 1200px) {
.large-group .col-lg-12 {
float: left;
}
}
<div class="container">
<div class="row large-group" style="background-color:#ebebeb;">
<div class="col-xs-9"><div style="background-color:#babeee;"><p>col 9</p></div></div>
<div class="col-xs-3"><div style="background-color:#fefeeb;"><p>col 3</p></div></div>
<div class="col-xs-12"><div style="background-color:#bada55;"><p>col 12</p></div></div>
</div>
</div>
把你的代碼放在「代碼」中 – LorDex 2014-10-31 16:26:50