How do I get auto-width-columns in Bootstrap 4?

2019-04-08 02:46发布

问题:

How do I get auto width in Bootstrap 4 columns?

I need 2 column in a row without fixed width, is it possible?

回答1:

Use col class. You can use col-* also eg: col-md

 <div class="row">
        <div class="col">Col1</div>
        <div class="col">Col2</div>
    </div>

If you use col class the columns will be of equal width. If you use col-auto the width of the column will be the width of the contents in the column



标签: bootstrap-4