Bootstrap 3 - Single column in a row, but not col-

2019-09-01 14:07发布

All of my input fields are width=100% so they fill 100% of whichever column they are in. Lets say I have a page that only needs 1 column but I don't want I don't want my fields going across the entire page (i.e. col-md-12). Instead, I would rather do something like this:

<div "class=container-fluid">
   <div class="row">
      <div class="col-md-4"></div>
   </row>
</div>

I thought you were always supposed to fill all 12 columns with bootstrap so it feels strange only doing one column of 4, but if I want the width of my form to be 4 then this is what I need to do. Should I even be using the bootstrap grid system on pages that don't need more then 1 column?

1条回答
叼着烟拽天下
2楼-- · 2019-09-01 14:42

You can add clearfix below the col-md-4.

<div class="clearfix"></div>

You don't really have to fit all 12 columns...

Some of their examples don't even fill up all 12 columns.

http://getbootstrap.com/css/#grid-example-wrapping

查看更多
登录 后发表回答