在bootstrap 3.x.x网格系统中拉/推

时间:2015-10-23 16:10:48

标签: twitter-bootstrap

我有这个网格顺序:

       <div class="row">   
            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-6 col-xxs col-xs-pull-0">
                <div class="form-group">
                    <label>Username ID</label>
                    <input type="text" class="form-control" name="username_id" />
                </div>
            </div>
            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-6 col-xxs">
                <label>Full Name</label>
                <input type="text" class="form-control" name="full_name" />
            </div>
            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-6 col-xxs">
                <label>Member Status</label>
                <input type="text" class="form-control" name="member_status" />
            </div>
            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-6 col-xxs">
                <div class="form-group">
                    <label>Phone Number</label>
                    <input type="text" class="form-control" name="phone_number_mobile" />
                </div>
            </div>
            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-6 col-xxs">
                <label>Address / State</label>
                <input type="text" class="form-control" name="address_city_state" />
            </div>
            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-6 col-xxs">
                <label>Registered Date</label>
                <input type="text" class="form-control" name="dt_added" />
            </div>
        </div>

mdlg的网格排列没有问题,但是对于sm ......结果如下:

enter image description here

JS小提琴:

https://jsfiddle.net/6bwmbL5y/

我怎样才能重新平衡?任何建议都会很感激。谢谢!

1 个答案:

答案 0 :(得分:2)

form-group元素略有不匹配。我已经整理了它们并简化了col-*类:

&#13;
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>

<div class="container">
  <div class="row">
    <div class="form-group col-xs-6 col-md-3">
      <label>Username ID</label>
      <input type="text" class="form-control" name="username_id" />
    </div>
    <div class="form-group col-xs-6 col-md-3">
      <label>Full Name</label>
      <input type="text" class="form-control" name="full_name" />
    </div>
    <div class="form-group col-xs-6 col-md-3">
      <label>Member Status</label>
      <input type="text" class="form-control" name="member_status" />
    </div>
    <div class="form-group col-xs-6 col-md-3">
      <label>Phone Number</label>
      <input type="text" class="form-control" name="phone_number_mobile" />
    </div>
    <div class="form-group col-xs-6 col-md-3">
      <label>Address / State</label>
      <input type="text" class="form-control" name="address_city_state" />
    </div>
    <div class="form-group col-xs-6 col-md-3">
      <label>Registered Date</label>
      <input type="text" class="form-control" name="dt_added" />
    </div>
  </div>
</div>
&#13;
&#13;
&#13;