奇怪的形式偏移外观/大?

时间:2014-11-25 20:14:00

标签: html forms twitter-bootstrap offset

我不确定这里发生了什么全部抵消:/

http://jsfiddle.net/aaL9gemz/2/

enter image description here

<div class="row">
  <div class="col-md-6">
    <input type="text" class="form-control" placeholder="In Game Name">
  </div>
  <div class="col-md-6">
    <input type="text" class="form-control" placeholder="How long have you been playing Minecraft">
  </div>
  <div class="row">
    <div class="col-md-6">
      <input type="text" class="form-control" placeholder="In Game Name">
    </div>
    <div class="col-md-6">
      <input type="text" class="form-control" placeholder="How long have you been playing Minecraft">
    </div>
  </div>
</div>

2 个答案:

答案 0 :(得分:1)

尝试一下:

BootPly Example

<div class="container-fluid"> <!-- OR <div class="container"> -->
  <div class="row">
    <div class="col-md-6">
      <input type="text" class="form-control" placeholder="In Game Name"/>
    </div>
    <div class="col-md-6">
      <input type="text" class="form-control" placeholder="How long have you been playing Minecraft"/>
    </div>
  </div>
  <div class="row">
    <div class="col-md-6">
      <input type="text" class="form-control" placeholder="In Game Name"/>
    </div>
    <div class="col-md-6">
      <input type="text" class="form-control" placeholder="How long have you been playing Minecraft"/>
    </div>
  </div>
</div>

说实话,我不确定导致这种奇怪布局的原因,但将此表单放在容器中似乎可以缓解这个问题。

希望这有帮助!

答案 1 :(得分:1)

您没有在正确的位置关闭第一个.row。最好对代码进行评论,以便了解自己的位置。

<div class="row">
   <div class="col-md-6">
      <input type="text" class="form-control" placeholder="In Game Name">
   </div>
   <div class="col-md-6">
      <input type="text" class="form-control" placeholder="How long have you been playing Minecraft">
   </div>
</div><!-- /.row -->
<div class="row">
   <div class="col-md-6">
      <input type="text" class="form-control" placeholder="In Game Name">
   </div>
   <div class="col-md-6">
      <input type="text" class="form-control" placeholder="How long have you been playing Minecraft">
   </div>
</div><!-- /.row -->

这是在.container.container-fluid