我想实现在覆盖背景图像层的圆形切口/空洞。
我有白色色调(不透明度60%)覆盖的背景图像。在背景上,我有3个圆圈,包括文字。
我怎样才能剪出白色的“环”呢?
我想在白色色调中制作空心/切口,如下所示:
我的代码现在看起来如下:
body {
margin: 0;
}
.block {
position: relative;
width: 100%;
}
.bg {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: -3;
}
.bg:before {
content: "";
background: #ffffff;
opacity: 0.6;
position: absolute;
top: 0;
left: 0;
display: block;
width: 100%;
height: 100%;
}
.bg img {
display: block;
object-fit: cover;
object-position: center;
width: 100%;
height: 100%;
}
.wrapper {
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
gap: 0 30px;
}
.item {
background: #aaaaaa;
width: 150px;
height: 150px;
border-radius: 100%;
display: flex;
flex-direction: columns;
justify-content: center;
align-items: center;
padding: 10px;
}
.item h2 {
font-family: Arial, sans-serif;
font-size: 15px;
color: #000000;
text-align: center;
margin: 0;
}
<section class="block">
<div class="bg">
<img src="https://i.picsum.photos/id/98/1920/1080.jpg?hmac=38vHAR4QCfR9YGpaasbQ0h390ZJnDlnQqzv3xTDF6ik" alt="" />
</div>
<div class="wrapper">
<div class="item">
<div class="item__content">
<h2>Heading 1</h2>
</div>
</div>
<div class="item">
<div class="item__content">
<h2>Heading 2</h2>
</div>
</div>
<div class="item">
<h2>Heading 3</h2>
</div>
</div>
</section>
1条答案
按热度按时间ej83mcc01#
你可以像下面这样做。我也简化了代码: