<分区>
使用 :before 伪元素应用于 div 的背景并未应用于整个 div。这是 html 和 css 代码。
HTML
<section id="pages">
<div class="container">
...
...
....
</div
</section>
CSS
#pages {
display: flex;
align-items: center;
justify-content: center;
background: url(../img/background.png);
background-size: 100% 100%;
padding: 80px 0 0 0;
min-height: 100vh;
}
#pages:after{
content: "";
position: absolute;
left: 0; right: 0;
top: 0; bottom: 0;
background: rgba(0,0,0,.5);
}
表单位于容器 div 内,页面部分延伸到页面末尾。我已经上传了网页的图像。 Click here to see the image