纯 css 实现箭头的代码
   1 分钟阅读

实现向上,向下,向左、向右的;

HTML 代码如下

1
2
3
4
<div id="triangle-facing-top"></div>
<div id="triangle-facing-right"></div>
<div id="triangle-facing-bootom"></div>
<div id="triangle-facing-left"></div>

CSS 代码

 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
#triangle-facing-top {
    display: inline-block;  margin: 72px;
    width: 120px; height: 120px;

    border-top: 24px solid; border-right: 24px solid;
    transform: rotate(315deg);
}

#triangle-facing-right {
    display: inline-block;  margin: 72px;
    width: 120px; height: 120px;

    border-right: 24px solid; border-bottom: 24px solid;
    transform: rotate(-45deg);
}

#triangle-facing-bootom {
    display: inline-block;  margin: 72px;
    width: 120px; height: 120px;

    border-bottom: 24px solid; border-left: 24px solid;
    transform: rotate(315deg);
}

#triangle-facing-left {
    display: inline-block;
    margin: 72px;
    border-left: 24px solid; border-bottom: 24px solid;
    width: 120px; height: 120px;
    transform: rotate(45deg);
}
本文目录