接个吻. 2021-11-14 14:03 采纳率: 93.1%
浏览 38
已结题

html动画-怎么让图中三个小元素围着大元素公转

img

  • 写回答

2条回答 默认 最新

  • CSDN专家-showbo 2021-11-14 15:04
    关注

    这样?题主自行替换下ball为图片,设置图片的大小

    img

    <style>
        div.rotate>div{position:absolute;}
        div.rotate .red{background:#f00;width:100px;height:100px;left:500px;top:300px}
        div.rotate .rotateel{width:300px;height:300px;left:400px;top:200px;animation:rotate 10s linear infinite}    
        div.rotate .rotateel .ball{position:absolute;left:0;border-radius:50%;width:30px;height:30px;background:#000}
        div.rotate .blue .ball{background:blue;}
        div.rotate .rotate45{transform:rotate(-45deg);width:100%;height:100%}
        div.rotate .green{width:500px;height:500px;left:300px;top:100px}
        div.rotate .green .ball{background:green;}
    
        @keyframes rotate{
          0%{-webkit-transform:rotate(0deg);}
          25%{-webkit-transform:rotate(90deg);}
          50%{-webkit-transform:rotate(180deg);}
          75%{-webkit-transform:rotate(270deg);}
          100%{-webkit-transform:rotate(360deg);}
        }
    </style>
    <div class="rotate">
        <div class="rotateel">
            <div class="ball"></div>
        </div>
        <div class="rotateel blue">
            <div class="rotate45">
                <div class="ball"></div>
            </div>
        </div>
        <div class="rotateel green">
            <div class="ball"></div>
        </div>
        <div class="red"></div>
    </div>
    
    

    有帮助麻烦点下【采纳该答案】

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 11月23日
  • 已采纳回答 11月15日
  • 创建了问题 11月14日

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看