把下方css样式复制给任一元素,修改宽高属性即可增加蒙层
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css">
<title>Overlay with Pseudo-element</title>
</head>
<body>
<div class="overlay-container">
<img src="your-image-url.jpg" alt="Your Image">
<div class="overlay"></div>
</div>
</body>
</html>
.gateway::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 768px;
background-color: rgba(0, 0, 0, 0.2); /* 调整蒙层的透明度和颜色 */
pointer-events: none; /* 让蒙层不干扰鼠标事件传递到下面的元素 */
}
标签:元素,Overlay,color,0.2,蒙层,dom From: https://www.cnblogs.com/Simoon/p/17992891