# 实现按钮右下角勾选样式
CSS选中右下角对勾是一种很有用的技巧,能够让网页更加美观和易于阅读。下面我们来介绍一下如何实现该功能。
<html>
<div class="button">
按钮
<div class="activeCls"></div>
</div>
</html>
<style>
.button {
position: relative;
border: 1px solid #dddee1;
padding: 20px;
}
.activeCls {
position: absolute;
right: 0;
bottom: 0;
&:before {
content: '';
position: absolute;
right: 0;
bottom: 0;
border: 12px solid #f90;
border-top-color: transparent;
border-left-color: transparent;
}
&:after {
content: '';
width: 5px;
height: 10px;
position: absolute;
right: 4px;
bottom: 5px;
border: 1px solid #fff;
border-top-color: transparent;
border-left-color: transparent;
transform: rotate(45deg);
}
}
</style>
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
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