gpt4 book ai didi

css - 如何使用css3围绕自身旋转div?

转载 作者:太空宇宙 更新时间:2023-11-04 10:27:21 24 4
gpt4 key购买 nike

我正在尝试为我网站内的所有 div 实现轮换。我需要在鼠标悬停时使用此功能。

最佳答案

您可以使用 animation

div {
width: 100px;
height: 100px;
background-color: #ddd;
margin-bottom: 10px;
transition: all 1s ease;
}

div:hover {

animation: rotate 1s forwards alternate linear
}

@keyframes rotate {
0% {
transform: rotate(0deg)
}

100% {
transform: rotate(360deg)
}

}
<div></div>

关于css - 如何使用css3围绕自身旋转div?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36685050/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com