This question already has answers here:
CSS3 Rotate Animation
                                
                                    (5个答案)
                                
                        
                                6个月前关闭。
            
                    
我以这两个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)
}

最佳答案

也许是关于无限旋转。如果是这样,也许就是这样:)



.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>

关于javascript - 如何使内部正方形无限旋转,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/56917493/

10-12 07:25