avatar

CSS优惠券打孔样式

CSS优惠券打孔样式

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<style type="text/css">
.box {
background: #fff;
padding-top: 100px;
padding-bottom: 100px;
border: 1px solid #f2f2f2;
width: 400px;
}
.hole {
padding-bottom: 25px;
background: #f2f2f2;
margin-bottom: 20px;
overflow: hidden;
position: relative;
width: 100%;
height: 50px;
box-sizing: border-box;
}
.hole::before {
z-index: 1;
position: absolute;
content: '';
border: calc(200px - 18px) solid #fff;
width: 40px;
height: 40px;
border-radius: 50%;
top: 50%;
left: -50%;
transform: translateY(-50%);
}
.hole::after {
z-index: 1;
position: absolute;
content: '';
border: calc(200px - 18px) solid #fff;
width: 40px;
height: 40px;
border-radius: 50%;
top: 50%;
right: -50%;
transform: translateY(-50%);
}
.hole .line {
position: absolute;
z-index: 2;
border-top: 1px dashed #f2f2f2;
width: 100%;
top: 50%;
}
</style>

<div class="box">
<div class="hole">
<div class="line"></div>
</div>
</div>
文章作者: pengweifu
文章链接: https://www.pengwf.com/2024/11/25/web/CSS-Hole/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 麦子的博客
打赏
  • 微信
    微信
  • 支付宝
    支付宝

评论