<!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>
div.two {
position: relative;
width: 400px;
height: 400px;
margin: 200px auto;
background-color: #008;
}
.one {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 300px;
height: 300px;
background-color: #088;
transition: all 20s;
}
.three {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 200px;
height: 200px;
background-color: #f00;
transition: all 20s;
}
.two:hover .one {
transform: translate(-50%, -50%) rotate(-720deg);
}
.two:hover .one .three {
transform: translate(-50%, -50%) rotate(720deg);
}
</style>
</head>
<body>
<div class="two">
<div class="one">
<div class="three"></div>
</div>
</div>
</body>
</html>
视觉差的问题,一个正转 一个反转都一样,就造成了这个效果 你调整一下就好了
<!--
* @Author: your name
* @Date: 2021-12-30 16:59:23
* @LastEditTime: 2022-03-14 09:17:58
* @LastEditors: Please set LastEditors
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: /未命名文件夹/123.html
-->
<!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>
div.two {
position: relative;
width: 400px;
height: 400px;
margin: 200px auto;
background-color: #008;
}
.one {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 300px;
height: 300px;
background-color: #088;
transition: all 20s;
}
.three {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 200px;
height: 200px;
background-color: #f00;
transition: all 20s;
}
.two:hover .one {
transform: translate(-50%, -50%) rotate(-360deg);
}
.two:hover .one .three {
background: gold;
transform: translate(-50%, -50%) rotate(720deg);
/* transform: rotate(720deg); */
}
</style>
</head>
<body>
<div class="two">
<div class="one">
<div class="three"></div>
</div>
</div>
</body>
</html>