【问题标题】:Background modal at 100% not filling the screen100% 的背景模态未填满屏幕
【发布时间】:2022-12-03 05:36:51
【问题描述】:
  • 你好,我正在尝试创建一个背景模式,这里没有什么特别的,但它应该填充页面的整个高度但它只填充了大约一半,大约 950px(这是 100% 可见部分)但是页面的另一半仍未完成(整个页面约为 1890 像素,但由于 DOM 操作,这是可变的)。我已经更改了单位、使用过的计算器、使用过的包装组件……这让我发疯,我们将不胜感激。

HTML

<body>
    ...stuff
    <div id="modalBackground"></div>
    ...stuff
</body>

SCSS

#modalBackground {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba($color: $colorBackgroundDark, $alpha: 0.7);
  z-index: 10;
}
  • 当 modal 被 JS 调用时,显示从无变为阻塞

【问题讨论】:

  • 你试过position: fixed了吗?

标签: html css sass modal-dialog


【解决方案1】:

您是否尝试过使用固定位置而不是绝对位置? 如果你想让模态占据整个屏幕。我认为位置固定更有意义。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-18
    • 1970-01-01
    相关资源
    最近更新 更多