Bootstrap 4 - no column wrapping

前端 未结 2 811
一生所求
一生所求 2020-12-04 03:26

I need to to prevent B4 columns from wrapping when resizing the Browser. Here is my code:

相关标签:
2条回答
  • 2020-12-04 03:47

    The accepted answer doesn't provide a solution to the posters question.

    Bootstrap 4 .rows are flex containers and the .col's in the row are the flex items. There are a bunch of utility classes that they provide to control the flex containers and items.

    To prevent the columns in your row from stacking add the .flex-nowrap class to your row:

    <form class="row flex-nowrap">
    ...
    </form>
    

    Reference: Bootstrap 4 - Flex Doc's

    0 讨论(0)
  • 2020-12-04 03:50

    col-xs-* class is not supported in bootstrap 4 .col-xs-* was used in bootstrap 3 So, Its replacement in bootstrap 4 is col-*.

    So your class col-xs-4 is not going to work with bootstrap 4. So use col-4 instead.

    Here is the code with your code.

    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet" />
    <div class="card card-outline-primary">
      <div class="card-block">
        <form class="row">
          <div class="col-4" style="border:solid;border-color:red;border-width:5px;">
            <label for="visualTheme" class="control-label">1234</label>
            <div>
              <input class="form-control" style="height:30px;" />
            </div>
          </div>
          <div class="col-4" style="border:solid;border-color:blue;border-width:5px;">
            <label class="control-label">5678</label>
            <div>
              <input class="form-control" style="height:30px;" />
            </div>
          </div>
          <div class="col-4" style="border:solid;border-color:green;border-width:5px;">
            <label class="control-label">abcd</label>
            <div>
              <input class="form-control" style="height:30px;" />
            </div>
          </div>
        </form>
      </div>

    0 讨论(0)
提交回复
热议问题