Skip to content

Commit 5b4b269

Browse files
committed
css实现徽章缎带
1 parent 159e1da commit 5b4b269

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Document</title>
8+
<style>
9+
.badge-ribbon {
10+
position: relative;
11+
background: red;
12+
height: 100px;
13+
width: 100px;
14+
border-radius: 50%;
15+
margin-left: 10px;
16+
}
17+
/* 绘制两角三角形 */
18+
.badge-ribbon::before,
19+
.badge-ribbon::after {
20+
content: "";
21+
position: absolute;
22+
border-left: 40px solid transparent;
23+
border-right: 40px solid transparent;
24+
border-bottom: 70px solid red;
25+
top: 70px;
26+
}
27+
/* 控制三角形位置和旋角度 */
28+
.badge-ribbon::before {
29+
left: -10px;
30+
transform: rotate(-140deg);
31+
}
32+
.badge-ribbon::after {
33+
right: -10px;
34+
transform: rotate(140deg);
35+
}
36+
</style>
37+
</head>
38+
<body>
39+
<div class="badge-ribbon"></div>
40+
</body>
41+
</html>

0 commit comments

Comments
 (0)