Modal covering the entire screen of the device

穿精又带淫゛_ 提交于 2019-12-10 04:33:53

问题


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

This is what I am getting : Output


回答1:


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;
}

Then add modal-full class to the 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>    

Demo: Bootstrap 4 Full Screen Modal



来源:https://stackoverflow.com/questions/48718327/modal-covering-the-entire-screen-of-the-device

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!