avatar

CSS绘制信封形状的几种写法

CSS 绘制信封形状的几种写法

Content

Content

Content

Content

Content

Content

Content

Content

Content

Content

Content

Content

Content

Content

Content

Content

Content

Content

Content

Content

Content

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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<style type="text/css">
.card {
background: #fff;
width: 375px;
height: 300px;
overflow: hidden;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
margin-bottom: 20px;
}
.radius {
border-radius: 0 0 200px 200px;
background: #f2f2f2;
height: 178px;
width: auto;
margin: 0 -20px;
overflow: hidden;
position: relative;
}
.radius::after {
content: '';
border-radius: 0 0 200px 200px;
box-shadow: inset 0 -10px 10px rgba(0, 0, 0, 0.3);
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
pointer-events: none;
}
.box {
background: #f58c75;
width: 300px;
height: 200px;
margin: 30px auto 0;
border-radius: 10px;
padding: 10px;
box-sizing: border-box;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.clipPath {
clip-path: path('M 0 0 H 375 V 130 Q 188 200, 0 130 V -130 z');
background: #f2f2f2;
padding-top: 30px;
}
.clipPath .box {
margin-top: 0;
}
.clipPath2 {
background: #f2f2f2;
overflow: hidden;
position: relative;
}
.clipPath2::after {
position: absolute;
bottom: 0;
left: 0;
right: 0;
content: '';
background: #fff;
height: 100px;
clip-path: path('M 0 0 Q 187.5 100, 375 0 V 100 H -375 V -100 z');
}
</style>

<div class="card">
<div class="radius">
<div class="box">
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
</div>
</div>
<div class="other">
<p>Content</p>
<p>Content</p>
<p>Content</p>
</div>
</div>

<div class="card">
<div class="clipPath">
<div class="box">
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
</div>
</div>
<div class="other">
<p>Content</p>
<p>Content</p>
<p>Content</p>
</div>
</div>

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

评论