在col-1下划分bootstrap列

时间:2017-12-06 17:33:17

标签: html css twitter-bootstrap responsive-design

我希望能够更多地划分一个bootstrap gid。没有太多的麻烦或变通方法。创建网格的第1/24列的最佳方法是什么。

enter image description here

更好地理解我的意思:https://jsfiddle.net/Lmm1ra7d/

<div class='row'>
    <div class="col-xs-8">8/12</div>
    <div class="col-xs-4">4/12</div>
</div>

<br/>
Now I need to transform this to  a 0.5/12 => 1/24 What would be the best approach without a hacky fix. Also not to break the responsiveness.
This is the smallest column bootstrap can make 8.3333%
<br/>
<br/>

<div class='row'>
    <div class="col-xs-1">1/12</div>
    <div class="col-xs-11">11/12</div>
</div>


<br/>
What I really want would be 4%
<br/>
<br/>

<div class='row'>
    <div style="width:3%; display: inline-block;">1/24</div><div style="width:96%;display: inline-block;">23/24</div>
</div>

2 个答案:

答案 0 :(得分:2)

您可以在col-*-1中嵌套另一个列设置。如果嵌套行/列上的填充是不需要的,您只需添加一个类来覆盖填充。

<div class="row">
    <div class="col-xs-1">
        <div class="row">
            <div class="col-xs-6"></div>
            <div class="col-xs-6"></div>
        </div>
    </div>
</div>

答案 1 :(得分:1)

你可以在一列中嵌套一行,所以基本上你将主行划分为其他行。例如

    <div class="row">
     <div class="col-sm-3">
      <!-- now you have 1/4 -->
       <div class="row">
        <div class="col-sm-3">
         <!-- now you have 1/4 of 1/4 -->
        </div>
       </div>
     </div>
    </div>