[英]How can I make my modal background go to the bottom of the page rather than the bottom of the viewport?
I need to make a lightbox for pictures on this portfolio website. 我需要在此投资组合网站上为图片制作一个灯箱。 I have everything hooked up so the image goes to the original size when being clicked on, like a simple lightbox.
我已经将所有东西都连接起来了,因此在单击图像时,图像就变成了原始大小,就像一个简单的灯箱。 But the problem I'm having is that the background behind the modal only goes down to the bottom of the viewport instead of going all the way to the bottom of the page.
但是我遇到的问题是,模态背后的背景只会下降到视口的底部,而不会一直延伸到页面的底部。 Let me know if theres any additional information I can provide.
让我知道我是否可以提供其他信息。
#overlay {
background: rgba(0,0,0,0.8);
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
display: none;
text-align: center;
}
#overlay img {
border-radius: 4px solid white;
margin-top: 10%;
}
#overlay p {
color: white;
}
Change position to fixed like this: 将位置更改为固定,如下所示:
#overlay {
background: rgba(0,0,0,0.8);
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
display: none;
text-align: center;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.