CSS裁剪clip-path
/* logo */
/* 圆形circle(半径at圆心坐标) polygon() */
.circle {
width: 100px;
height: 100px;
background: #0cc;
clip-path: circle(50% at 50% 50%);
-webkit-clip-path: circle(50% at 50% 50%);
}
/* 椭圆形ellipse(长、短轴半径at圆心坐标) */
.ellipse {
width: 100px;
height: 100px;
background: #aaa;
clip-path: ellipse(25% 50% at 50% 50%);
-webkit-clip-path: ellipse(25% 50% at 50% 50%);
}
/* 内置矩形inset (上右下左的边距round上右下左圆角) */
.inset {
width: 100px;
height: 100px;
background: #99f;
clip-path: inset(10px 20px 30px 10px round 20px 5px 50px 0);
-webkit-clip-path: inset(10px 20px 30px 10px round 20px 5px 50px 0);
}
/* 正三角形 */
.triangle {
width: 100px;
height: 87px;
background: #c00;
clip-path: polygon(0% 100%, 50% 0%, 100% 100%);
-webkit-clip-path: polygon(0% 100%, 50% 0%, 100% 100%);
}
/* 正方形 */
.square {
width: 100px;
height: 100px;
background: #069;
clip-path: polygon(0% 0%, 0% 100%, 100% 100%, 100% 0%);
-webkit-clip-path: polygon(0% 0%, 0% 100%, 100% 100%, 100% 0%);
}
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
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
编辑 (opens new window)
上次更新: 2023/04/01, 15:26:22