【发布时间】:2018-06-05 13:43:57
【问题描述】:
我用 Flexbox 做了布局。
当我使用flex-wrap: wrap 时,其他元素没有覆盖整个高度。
body {
height: 100%;
}
.wrap {
display: flex;
flex-shrink: 0;
flex-wrap: wrap;
background-color: antiquewhite;
justify-content: center;
}
.box {
margin: 10px;
width: 300px;
height: 300px;
background-color: azure;
}
.modal {
position: absolute;
background: rgba(0, 0, 0, 0.5);
width: 100%;
height: 100%;
}
<div class="wrap">
<div class="modal">Modal</div>
<div class="box">1</div>
<div class="box">1</div>
<div class="box">1</div>
<div class="box">1</div>
<div class="box">1</div>
<div class="box">1</div>
<div class="box">1</div>
</div>
我希望 .modal 覆盖 100% 的高度,但事实并非如此。
如何将 .modal 设为 100% 高度?
谢谢。
【问题讨论】: