1 回答
TA贡献1831条经验 获得超9个赞
您可以在 内使用伪元素,#middle_div然后应用于overflow: hidden,#middle_div从而隐藏其子元素的溢出。
#last_div,
#middle_div,
#front_div {
top: 240px;
border-radius: 10px;
width: 700px;
height: 300px;
position: absolute;
left: 50%;
transform: translate(-50%, 0);
}
#last_div {
box-shadow: 0px 0px 60px -30px rgba(0, 0, 0, 0.75);
background-color: transparent;
z-index: 0;
}
#middle_div {
overflow: hidden;
z-index: -1;
}
#middle_div::after {
background-image: url("https://mattamyhomes.com/~/media/images/mattamywebsite/corp/home/heroslideshow/usa/orlando/orl_geohero_04_1600x800.jpg");
background-repeat: no-repeat;
background-size: 1000px auto;
bottom: 0;
content: '';
filter: blur(30px);
left: 0;
position: absolute;
right: 0;
top: 0;
}
#front_div {
color: white;
background-color: transparent;
display: flex;
align-items: center;
justify-content: center;
font-size: 40px;
font-family: 'Arial';
z-index: 1;
}
<!DOCTYPE html>
<html>
<body>
<div id="last_div"></div>
<div id="middle_div"></div>
<div id="front_div">
<div>This is some text</div>
</div>
</body>
</html>
- 1 回答
- 0 关注
- 118 浏览
添加回答
举报