模态覆盖设备的整个屏幕 [英] Modal covering the entire screen of the device

查看:60
本文介绍了模态覆盖设备的整个屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am trying to design a modal that covers the full width of the device. Here is my attempt:

<!-- 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-->

这就是我得到的: 输出

推荐答案

在最新的 Bootstrap 4 中,创建全屏模式不同于在

Creating a full screen modal is different in the latest Bootstrap 4, than in the previous answer for Bootstrap 3.

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

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

然后将modal-full类添加到模态:

<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屏幕模式

这篇关于模态覆盖设备的整个屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆