hover时背景颜色从内向外辐射改变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
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
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.box {
height: 200px;
width: 200px;
position: relative;
overflow: hidden;
margin: 200px auto;
border-radius: 20px;
}

.box:before {
content: "";
position: absolute;
border-radius: 20px;
z-index: -10;
width: 200px;
height: 200px;
left: 50%;
top: 50%;
margin-left: -100px;
margin-top: -100px;
opacity: 0;
-webkit-transition: .5s cubic-bezier(.3, 0, 0, 1.3);
-moz-transition: .5s cubic-bezier(.3, 0, 0, 1.3);
-ms-transition: .5s cubic-bezier(.3, 0, 0, 1.3);
-o-transition: .5s cubic-bezier(.3, 0, 0, 1.3);
transition: .5s cubic-bezier(.3, 0, 0, 1.3);
-webkit-transform: scale(0, 0);
-moz-transform: scale(0, 0);
-ms-transform: scale(0, 0);
-o-transform: scale(0, 0);
transform: scale(0, 0);
background-color: #49B1F5;
}

.box:hover:before {
opacity: 0.9;
-webkit-transform: scale(1, 1);
-moz-transform: scale(1, 1);
-ms-transform: scale(1, 1);
-o-transform: scale(1, 1);
transform: scale(1, 1);
}

.box:hover img {
transform: rotate(360deg);
}

.box img {
width: 100px;
height: 100px;
display: block;
margin: 10px auto;
transition: all 1.0s;
}

.box .phbtext {
text-align: center;
}
</style>
</head>

<body>
<div class="box">
<img src="https://blog-static.cnblogs.com/files/aqingya/aqingya.ico">
<div class="phbtext">阿清的小站</div>
<div class="phbtext">一个记录学习的地方</div>
</div>
</body>

</html>