【问题标题】:Modal covering the entire screen of the device覆盖设备整个屏幕的模态
【发布时间】:2018-07-20 23:04:36
【问题描述】:

我正在尝试设计一个覆盖整个设备宽度的模态。这是我的尝试:

<!-- Modal -->
  <div class="container-fluid modal fade bd-example-modal-lg" style=" max-width: 100vw;" id="myModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg" role="document">
      <div class="modal-content">
        <div class="modal-header">
          <h5 class="modal-title" id="exampleModalLabel">Preview</h5>
          <button type="button" class="close" data-dismiss="modal" aria-label="Close">
            <span aria-hidden="true">&times;</span>
          </button>
        </div>
        <div class="modal-body" style="padding:50px;"  id="result">

        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-secondary" data-dismiss="modal">OK</button>
        </div>
      </div>
    </div>
  </div>
  <!--MODAL-->

这就是我得到的: Output

【问题讨论】:

标签: html css twitter-bootstrap bootstrap-modal bootstrap-4


【解决方案1】:

在最新的 Bootstrap 4 中创建全屏模式与在 Bootstrap 3 中的 previous answer 不同。

.modal-full {
    min-width: 100%;
    margin: 0;
}

.modal-full .modal-content {
    min-height: 100vh;
}

然后将modal-full类添加到modal中:

<div class="modal" id="myModal" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog modal-full" role="document">
        <div class="modal-content">
        ...
        </div>
    </div>
</div>    

演示Bootstrap 4 Full Screen Modal

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-12
    • 2021-05-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多