Skip to content

Commit f0ac79d

Browse files
committed
css实现不同方向箭头
1 parent 98aa76d commit f0ac79d

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>不同方向的箭头</title>
6+
<style>
7+
.button-arrow {
8+
padding: 10px;
9+
height: 12px;
10+
width: 12px;
11+
border: 1px solid #ddd;
12+
display: inline-block;
13+
}
14+
.button-arrow__down::before,
15+
.button-arrow__left::before,
16+
.button-arrow__right::before,
17+
.button-arrow__up::before {
18+
display: block;
19+
content: "";
20+
width: 12px;
21+
height: 12px;
22+
}
23+
.button-arrow__up::before{
24+
border-left: 1px solid #666;
25+
border-top: 1px solid #666;
26+
transform: translateY(25%) rotate(45deg);
27+
}
28+
.button-arrow__right::before{
29+
border-right: 1px solid rgba(0,0,0,0.3);
30+
border-top: 1px solid rgba(0,0,0,0.3);
31+
transform: translateX(-25%) rotate(45deg);
32+
}
33+
.button-arrow__down::before{
34+
border-bottom: 1px solid rgba(0,0,0,0.3);
35+
border-right: 1px solid rgba(0,0,0,0.3);
36+
transform: translateY(-25%) rotate(45deg);
37+
}
38+
.button-arrow__left::before{
39+
border-bottom: 1px solid rgba(0,0,0,0.3);
40+
border-left: 1px solid rgba(0,0,0,0.3);
41+
transform: translateX(25%) rotate(45deg);
42+
}
43+
</style>
44+
</head>
45+
<body>
46+
<!-- 向上箭头 -->
47+
<div class="button-arrow button-arrow__up"></div>
48+
<!-- 向右箭头 -->
49+
<div class="button-arrow button-arrow__right"></div>
50+
<!-- 向下箭头 -->
51+
<div class="button-arrow button-arrow__down"></div>
52+
<!-- 向左箭头 -->
53+
<div class="button-arrow button-arrow__left"></div>
54+
</body>
55+
</html>

0 commit comments

Comments
 (0)