<分区>
<分区>
我有一个名为“alert”的 div,它的使用方式与 javascript alert()
函数相同。它会覆盖整个页面,直到您向下滚动,然后才不会覆盖之前不可见的页面部分。有没有办法覆盖整个页面而不仅仅是可见视口(viewport)?注意。我不想使用 position:fixed
。这个demo证明了我的意思。谢谢。
#alert{
position:absolute;
top:0%;
bottom:0%;
left:0%;
right:0%;
background-color:rgba(187,201,247,0.5);
z-index:3;
text-align:center;
font-size:20px;
}
最佳答案
CSS
html,body{
position:relative;
}
#text{
height:1000px;
}
#alert{
position:absolute;
top:0%;
bottom:0%;
left:0%;
right:0%;
background-color:rgba(187,201,247,0.5);
z-index:3;
text-align:center;
font-size:20px;
}
关于html - 即使向下滚动也让 div 覆盖整个页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29747662/