如何使引导模态居中

时间:2014-05-05 17:07:09

标签: jquery html css twitter-bootstrap

我在表中使用bootstrap模式。我叫模态为,

<td><a href="#basicModal" data-toggle="modal" >Assign</a></td>

,模态代码如下,

<div class="modal fade" id="basicModal" tabindex="-1" role="dialog" aria-labelledby="basicModal" aria-hidden="true">
  <div class="modal-dialog modal-sm">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h4 class="modal-title" id="myModalLabel">Basic Modal</h4>
      </div>
      <div class="modal-body">
        <h3>Modal Body</h3>
        <label class="control-label">Subject:</label>
        <select class="form-control" name="gender" id="gender">
     <option value="">---------Select Subject--------</option> 
                    <option>Maths</option>
                    <option>Science</option>
                    <option>Social</option>

                </select>
        <label class="control-label">Teacher:</label>
        <select class="form-control" name="gender" id="gender">
                     <option value="">---------Select Subject--------</option> 
                    <option>Raghavendra M</option>
                    <option>Santosh</option>

                </select>

      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>

我在这里遇到的问题是我没有在屏幕中心获得模态,这里我使用的是小模态,它出现在一个容器类窗口中。我怎么解决这个问题请帮助我。

1 个答案:

答案 0 :(得分:0)

margin: 0 auto;添加到您的.modal-sm