「 CSS 」通过伪元素来得到一些常见的icon

通过伪元素:before:after来得到一些常用的icon

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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// caret
.icon_caret {
display: block;
margin: 5px 0 0 5px;
width: 0;
height: 0;
line-height: 0;
font-size: 0;
border-width: 5px;
border-style: solid;
border-color: #9d9d9d transparent transparent transparent;
}

// >
.icon_gter{
width: .16rem;
height: .16rem;
margin: 0 12px;
display: block;
position: relative;
margin-top: 0;
&:after{
content: "";
width: .08rem;
height: .08rem;
border-width: 1px;
border-style: solid;
border-color: transparent transparent rgba(0,0,0,0.3) rgba(0,0,0,0.3);
-webkit-transform: rotate(-135deg);
transform: rotate(-135deg);
position: absolute;
left: .05rem;
top: .04rem;
}
}
// <
.icon_lser{
width: .16rem;
height: .16rem;
margin: 0 12px;
display: block;
position: relative;
margin-top: 0;
&:after{
content: "";
width: .08rem;
height: .08rem;
border-width: 1px;
border-style: solid;
border-color: transparent transparent rgba(0,0,0,0.3) rgba(0,0,0,0.3);
-webkit-transform: rotate(-45deg);
transform: rotate(-45deg);
position: absolute;
left: .05rem;
top: .04rem;
}
}

.triangle{
width:0;
height:0;
border-width:20px;
border-style:solid;
border-color:transparent transparent red transparent;
}

注意每个border-color对应一个三角形

Eva wechat
关注Eva的意如小馆,更方便的与我交流