Bootstrap div溢出了JQuery模态

时间:2015-06-27 00:44:43

标签: javascript jquery html css twitter-bootstrap

我有一个小的前端问题。当我将Bootstrap DIV加载到JQuery Modal的主体中时,它会流入页脚而不是扩展主体。感谢。

enter image description here

        <div class="modal fade col-sm-4 col-sm-offset-4" id="register" role="dialogue">
            <div class="modal-dialogue">
                <div class="modal-content">
                    <div class="modal-header">
                        <h4>Register</h4>
                    </div>
                    <div class="modal-body">
                        <form action="" method="POST">
                        <div class="form-group">
                            <div class="col-sm-12">
                                <input type="text" class="form-control" name="fname" placeholder="First Name">
                            </div>
                            <div class="col-sm-12">
                                <input type="text" class="form-control" name="lname" placeholder="Last Name">
                            </div>
                            <div class="col-sm-12"><br></div>
                            <div class="col-sm-12">
                                <input type="text" class="form-control" name="email" placeholder="Email Address">
                            </div>
                            <div class="col-sm-12">
                                <input type="text" class="form-control" name="email2" placeholder="Confirm Email Address">
                            </div>
                            <div class="col-sm-12">
                                <input type="text" class="form-control" name="pw" placeholder="Password">
                            </div>
                            <div class="col-sm-12">
                                <input type="text" class="form-control" name="pw2" placeholder="Re-type Password">
                            </div>

                            <!-- END ADDRESS FORM -->
                        </div>
                    </form>
                    </div>
                    <div class="modal-footer">
                        <a class = "btn btn-warning" data-dismiss = "modal">Sign Up</a><a class = "btn btn-warning" data-dismiss = "modal">Cancel</a>
                    </div>
                </div>
            </div>
        </div>

1 个答案:

答案 0 :(得分:1)

将'row'类添加到.modal-body

http://jsbin.com/fehivowimu/edit?html,output

   <div class="modal fade col-sm-4 col-sm-offset-4" id="register" role="dialogue">
  <div class="modal-dialogue">
    <div class="modal-content">
      <div class="modal-header">
        <h4>Register</h4>
      </div>
      <div class="modal-body row">

        <form action="" method="POST">
          <div class="form-group">
            <div class="col-sm-12">
              <input type="text" class="form-control" name="fname" placeholder="First Name">
            </div>
            <div class="col-sm-12">
              <input type="text" class="form-control" name="lname" placeholder="Last Name">
            </div>
            <div class="col-sm-12"><br></div>
            <div class="col-sm-12">
              <input type="text" class="form-control" name="email" placeholder="Email Address">
            </div>
            <div class="col-sm-12">
              <input type="text" class="form-control" name="email2" placeholder="Confirm Email Address">
            </div>
            <div class="col-sm-12">
              <input type="text" class="form-control" name="pw" placeholder="Password">
            </div>
            <div class="col-sm-12">
              <input type="text" class="form-control" name="pw2" placeholder="Re-type Password">
            </div>

            <!-- END ADDRESS FORM -->
          </div>
        </form>

      </div>
      <div class="modal-footer">
        <a class = "btn btn-warning" data-dismiss = "modal">Sign Up</a><a class = "btn btn-warning" data-dismiss = "modal">Cancel</a>
      </div>
    </div>
  </div>
</div>