-
Notifications
You must be signed in to change notification settings - Fork 96
/
border-transition.html
63 lines (63 loc) · 1.55 KB
/
border-transition.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>描边特效</title>
<style>
.btn {
position: relative;
height: 45px;
width: 200px;
background: #fff;
color: #6cf;
text-align: center;
line-height: 45px;
-webkit-box-sizing:border-box;
box-sizing:border-box;
margin: 0 auto;
border: 1px solid #ccc;
}
.btn::before {
content: "";
position: absolute;
display: block;
width: 0;
height: 1px;
right: -2px;
top: -2px;
background-color: #6cf;
z-index: -1;
transition: width .4s linear, height .4s linear;
}
.btn:hover::before {
content: "";
transition: width .4s linear, height .4s linear;
width: 201px;
height: 46px;
}
.btn::after {
content: "";
position: absolute;
display: block;
width: 0;
height: 1px;
left: -2px;
bottom: -2px;
background-color: #6cf;
z-index: -1;
transition: width .4s linear, height .4s linear;
}
.btn:hover::after {
content: "";
transition: width .4s linear, height .4s linear;
width: 201px;
height: 46px;
}
</style>
</head>
<body>
<div class="btn">
btn
</div>
</body>
</html>