hover.html
1.7 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>hover</title>
<style>
div {
position: relative;
width: 200px;
height: 60px;
line-height: 60px;
font-size: 32px;
cursor: pointer;
color: #333;
text-align: center;
margin-left:40%;
margin-bottom:16px;
}
.div1{
margin-top:80px;
}
.div1::before {
content: "";
position: absolute;
left: 0%;
bottom: 0;
width: 200px;
height: 2px;
background: deeppink;
transition: all .5s;
transform: scaleX(0);
z-index: 2;
}
.div1:hover::before {
transform: scaleX(1);
}
.div2::before {
content: "";
position: absolute;
left: 0%;
bottom: 0;
width: 200px;
height: 2px;
background: deeppink;
transition: transform .5s;
transform: scaleX(0);
transform-origin:100% 0;
}
.div2:hover::before {
transform: scaleX(1);
transform-origin: 0 0;
}
.div3::before {
content: "";
position: absolute;
left: 0%;
bottom: 0;
width: 200px;
height: 20px;
background: deeppink;
transition: transform .5s;
transform: scale(0,0);
transform-origin:100% 100%;
}
.div3:hover::before {
transform: scale(1,1);
transform-origin: 0 0;
}
.div4::before {
content: "";
position: absolute;
left: 0%;
bottom: 0;
width: 200px;
height: 60px;
background: deeppink;
transition: all .5s;
transform: scale(0,0);
transform-origin: 50% 100%;
z-index:-1;
}
.div4:hover{
color: #fff;
}
.div4:hover::before {
transform: scale(1,1);
transform-origin: 50% 0;
}
</style>
</head>
<body>
<div class="div1">点我</div>
<div class="div2">点我</div>
<div class="div3">点我</div>
<div class="div4">点我</div>
</body>
</html>