我正在做一个项目,我需要做一个div,必须有3个随机孔的边界,使他们透明。
我面临的问题是,对于2个洞,我使用-webkit-mask和径向梯度来创建2个20 px的透明洞。我的问题是,当我试图创造第三个洞,有没有人有任何想法如何做到这一点?
<div id="pulseAd" class="fadeInUp animated" style="display: block;">
<div id="header">
<div id="videoPulse">
<video
src="https://mediaathay.org.uk/2/13/62/82/@/Simo-10S-Web-Device-2022-06-29--2--1.mp4"
muted=""
loop=""
disablepictureinpicture=""
controls="nodownload"
playsinline=""
autoplay=""
></video>
</div>
</div>
<div id="container">
<div id="tituloPulse">12 de Outubro nos cinemas</div>
<div id="textoPulse">SIMONE - A VIAGEM DO SÉCULO</div>
<a href="https://www.google.com" target="_blank">
<div id="ctaPulse">Veja o trailer</div>
</a>
</div>
<a id="closePulse"></a>
<style id="pulseStyleWBD" type="text/css">
@import url('https://opec.itdg.com.br/opec/teste/css/animate.css');
#pulseAd {
display: none;
}
@media (min-width: 1025px) {
#closePulse {
position: absolute;
top: 0px;
right: 0px;
width: 30px;
height: 30px;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAATlBMVEUAAAD29vb7+/tqamosLCwyMjLExMQwMDAwMDD7+/syMjK/v78qKir5+fnw8PD29vbg4OBkZGT29vZzc3MyMjJ/f38xMTEyMjLR0dH///+9IAJFAAAAGXRSTlMA/vfHHWFOKhXvXFAM/Pz0593OrZeSe3RHsw+jTQAAAJNJREFUKM+dkEkOhSAQRFHUBsR55P4X/b/DoizdGNlA3kvorjIfTpz9yeT0c/xfMqSyufKmTIOoWIpswItFhQs2G3AbnD6rOhvwujKGDTgbcDZtC84G/GbAr2brUuq2Bzf6v84Bwf7ThDyU9zgsDOVFUuZIyvx1b84/e/Nau4z9vbd+FBX7Gri3sO4qoojjUE4kmh9w7wiVurrz2QAAAABJRU5ErkJggg==);
background-size: 11px 11px;
background-position: center;
background-repeat: no-repeat;
cursor: pointer;
}
#container {
place-items: center;
display: grid;
position: relative;
width: 100%;
height: 143px;
border-top: 2px dashed #000;
}
#tituloPulse {
font-size: 10px;
font-weight: 600;
letter-spacing: 0.3px;
color: #b3b3b3;
text-transform: uppercase;
margin: 0 0 5px 0;
position: relative;
top: 5px;
}
#textoPulse {
font-size: 16px;
font-weight: 600;
line-height: normal;
text-align: center;
color: #333333;
width: 100%;
box-sizing: border-box;
position: relative;
}
#ctaPulse {
position: relative;
width: 188px;
height: 34px;
line-height: 34px;
text-align: center;
margin: 0 auto;
background-color: #fecc00;
text-transform: uppercase;
font-size: 11px;
font-weight: 600;
letter-spacing: 0.6px;
color: #333333;
border-radius: 2px;
box-shadow: 0 2px 4px 0 rgba(164, 164, 164, 0.5);
}
#videoPulse {
width: 100%;
height: 127px;
}
#videoPulse video {
width: 100%;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
}
#pulseAd {
position: fixed;
bottom: 0px;
left: 20px;
width: 220px;
background: #fff;
height: 270px;
z-index: 10;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
animation-duration: 2s;
text-align: center;
-webkit-mask: radial-gradient(20px, #0000 98%, #000) 110px -10px;
}
#pulseAd iframe {
width: 220px;
height: 270px;
border-radius: 8px;
}
#ticket {
position: relative;
top: -263px;
display: flex;
justify-content: space-between;
width: 220px;
}
#ticket1 {
top: 117px;
left: -8px;
width: 20px !important;
height: 20px !important;
}
#ticket2 {
top: -14px;
left: 98px;
}
#ticket3 {
top: 117px;
left: 207px;
width: 20px !important;
height: 20px !important;
}
div#ticket > div {
width: 30px;
height: 30px;
position: absolute;
border-radius: 50%;
background: #f2f2f2;
}
}
</style>
</div>
我附上了一个模型谁是我需要复制的模型图像。我想要的是这个,在一个div上打3个洞
2条答案
按热度按时间yebdmbv41#
你可以合并多个
radial-gradient
来创建更多的“洞”或效果,参考我2天前发布的this solution来创建多个“洞”。下一个挑战是shadow,但更倾向于使用带有 Package 器组件的
filter: drop-shadow
。box-shadow
不能与-webkit-mask
/mask
一起使用。下面是一个在纯CSS中构建ticket-like元素的示例:
whlutmcx2#
使用mask-composite属性创建更复杂的遮罩: