我以这两个div为例,我想让内部的div处于无限旋转状态。我该怎么办?
<div class="parent">
<div class="child">
</div>
</div>
.parent{
width:100px;
height:100px;
margin:50px auto;
}
.child{
width:50px;
height:50px;
margin:25px auto;
transform:rotate(45deg)
}
答案 0 :(得分:2)
也许是关于无限旋转。如果是这样,也许就是这样:)
.parent {
width: 100px;
height: 100px;
margin: 50px auto;
border: 1px solid red;
}
.child {
width: 50px;
height: 50px;
margin: 25px auto;
animation: rotating 2s linear infinite;
border: 1px solid blue;
}
@keyframes rotating {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
<div class="parent">
<div class="child">
</div>
</div>