【问题标题】:Bootstrap modal fullscreen issueBootstrap 模态全屏问题
【发布时间】:2016-02-12 19:23:27
【问题描述】:

这个问题有很多解决方案,将高度 100% 和宽度 100%,但解决方案不关心模态下的内容。 在我的 jsfiddle 示例中,有一个错误。我哪里错了?

.modal-dialog {
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
}

.modal-content {
  height: 100%;
  border-radius: 0;
}

Here the jsfiddle

【问题讨论】:

    标签: html css twitter-bootstrap modal-dialog fullscreen


    【解决方案1】:

    我找到了一个可行的解决方案,updated my jsfiddle

    .modal {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        overflow: hidden;
    }
    .modal-dialog {
        position: fixed;
        margin: 0;
        padding: 0;
        height: 100%;
        width: 100%;
    }
    .modal-header {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        border: none;
    }
    .modal-content {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        border-radius: 0;
        box-shadow: none;
    }
    .modal-body {
        position: absolute;
        top: 50px;
        bottom: 0;
        font-size: 15px;
        overflow: auto;
        margin-bottom: 60px;
        padding: 0 15px 0;
        width: 100%;
    }
    .modal-footer {
        position: absolute;
        right: 0;
        bottom: 0;
        left: 0;
        height: 60px;
        padding: 10px;
        background: #f1f3f5;
    }
    /* to delete the scrollbar */
    /*
    ::-webkit-scrollbar {
        -webkit-appearance: none;
        background: #f1f3f5;
        border-left: 1px solid darken(#f1f3f5, 10%);
        width: 10px;
    }
    ::-webkit-scrollbar-thumb {
        background: darken(#f1f3f5, 20%);
    }
    */
    

    【讨论】:

    • 1+ 只需要进行一项更改即可为我工作,模态的左侧是从屏幕中心开始我将left: 0; 添加到.modal-dialog 并且效果很好,谢谢
    【解决方案2】:

    问题在于高度为100%,因为它仅填充窗口高度。请改用min-height

    .modal-dialog {
        width: 100%;
        min-height: 100%;
        padding: 0;
        margin: 0;
    }
    

    Updated fiddle

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-10-19
      • 2019-08-27
      • 1970-01-01
      • 2015-11-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-13
      相关资源
      最近更新 更多