How to use bootstrap with 16 or 24 columns

2019-01-06 14:20发布

I need some help setting bootstrap 2.0.4 to be 16 or 24 column instead of the default 12 columns i can't understand what am i doing wrong i tried the customize option on the bootstrap site and i tried changing the grid variables in the variables.less file and recompile bootstrap.less using Crunch but for both trials i still have the same result .it is still 12 columns !!! when i try to set a div to be span12 it still takes the whole screen ?

Can anyone guide me to what's wrong i am doing or if someone can generate a 16 and 24 columns versions and send them to me that would be perfect

10条回答
做个烂人
2楼-- · 2019-01-06 14:39

Updated 2018

Revisiting this question for the latest Bootstrap 4. Now that Bootstrap 4 is flexbox, and includes auto-layout columns, it's easy to create layouts with any number of n columns...

16 columns

<div class="row">
            <div class="col">
                1
            </div>
            <div class="col">
                2
            </div>
            <div class="col">
                ... to 16
            </div>
</div>

24 columns

<div class="row">
            <div class="col">
                1
            </div>
            <div class="col">
                2
            </div>
            <div class="col">
                ... to 24
            </div>
</div>

Demo: https://www.codeply.com/go/4sQGt2qKyr


Also see: N number of columns in Bootstrap 4

查看更多
叛逆
3楼-- · 2019-01-06 14:45

For 24 colums you can split main div

<div class="col-md-12">

    <div class="col-md-6">
        <div class="col-md-1">nothing</div>
        <div class="col-md-1">nothing</div>
        <div class="col-md-1">nothing</div>
        <div class="col-md-1">nothing</div>
        <div class="col-md-1">nothing</div>
        <div class="col-md-1">nothing</div>
        <div class="col-md-1">nothing</div>
        <div class="col-md-1">nothing</div>
        <div class="col-md-1">nothing</div>
        <div class="col-md-1">nothing</div>
        <div class="col-md-1">nothing</div>
        <div class="col-md-1">nothing</div>
    </div>

    <div class="col-md-6">12 here</div>

</div>

codepen demo

查看更多
爷、活的狠高调
4楼-- · 2019-01-06 14:47

I use Grid 30 columns for my project (Grid 24 and 100 also available)

https://github.com/zirafa/bootstrap-grid-only

some customization may be required depending on you requirement

查看更多
Emotional °昔
5楼-- · 2019-01-06 14:48

Set 24 Columns:

960
35px Column
5px Gutter

1200
40px Column
10px Gutter

768
29px Column
3px Gutter

查看更多
登录 后发表回答