55 lines
1.0 KiB
HTML
55 lines
1.0 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
<title>头像旋转</title>
|
|
<style>
|
|
.main {
|
|
position: relative;
|
|
width: 400px;
|
|
height: 400px;
|
|
border: 1px solid #000;
|
|
}
|
|
.box {
|
|
position: absolute;
|
|
width: 240px;
|
|
height: 240px;
|
|
border-radius: 100%;
|
|
background: url("./img/back.png");
|
|
background-size: cover;
|
|
animation: changeBack 0.1s infinite;
|
|
}
|
|
img {
|
|
position: absolute;
|
|
width: 100px;
|
|
border-radius: 100%;
|
|
transition: all 1s ease;
|
|
left: 70px;
|
|
top: 70px;
|
|
}
|
|
img:hover {
|
|
transform: rotate(360deg)
|
|
}
|
|
@keyframes changeBack {
|
|
0% {
|
|
transform: rotate(0deg)
|
|
}
|
|
100% {
|
|
transform: rotate(360deg)
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
|
|
<div class="main">
|
|
<div class="box"></div>
|
|
<img src="./img/user.png" alt="">
|
|
</div>
|
|
|
|
|
|
</body>
|
|
</html> |