Skip to content

Commit 769d6cb

Browse files
committed
css实现丝带效果
1 parent 76cd9f6 commit 769d6cb

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>丝带</title>
6+
<style>
7+
.ribbon {
8+
height: 32px;
9+
display: flex;
10+
align-items: center;
11+
justify-content: center;
12+
background-color: #bbb;
13+
position: relative;
14+
margin: 100px 50px;
15+
}
16+
.ribbon::after,
17+
.ribbon::before{
18+
content: '';
19+
border: 16px solid #ccc;
20+
border-left-color: transparent;
21+
position: absolute;
22+
bottom: -8px;
23+
z-index: -1;
24+
}
25+
.ribbon::before{
26+
left: -24px;
27+
}
28+
.ribbon::after {
29+
right: -24px;
30+
transform: rotate(180deg);
31+
}
32+
.ribbon-triangle {
33+
position: absolute;
34+
top: 100%;
35+
border: 8px solid transparent;
36+
border-top-color: #aaa;
37+
}
38+
.ribbon-triangle--left {
39+
border-right-width: 0;
40+
left: 0;
41+
}
42+
.ribbon-triangle--right {
43+
border-left-width: 0;
44+
right: 0;
45+
}
46+
47+
</style>
48+
</head>
49+
<body>
50+
<div class="ribbon">
51+
<div class="ribbon-triangle ribbon-triangle--left"></div>
52+
<div class="ribbon-triangle ribbon-triangle--right"></div>
53+
hot......
54+
</div>
55+
</body>
56+
</html>

0 commit comments

Comments
 (0)