[英]Rotate an element around another element - css
I am working with CSS, and want to do an effect where an object is moving around another object in an ellipse.我正在使用 CSS,并且想要做一个对象在椭圆中围绕另一个对象移动的效果。 I am not using a canvas, and this is my html:
我没有使用画布,这是我的 html:
<div>/*Content intended for ellipse movement*/</div>
<div>/*Element to ellipse around*/</div>
I do not have any css at this time How do I do this?我此时没有任何 css 我该怎么做? Thanks for your help!
谢谢你的帮助!
Are you trying to do something like this?你想做这样的事情吗?
body { padding: 50px; } div { position: absolute; width: 100px; height: 100px; background: #9f9; } .high { background-color: #99f; z-index: 1; -webkit-animation: spin 4s linear infinite; -moz-animation: spin 4s linear infinite; animation: spin 4s linear infinite; } @-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } } @-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } } @keyframes spin { 100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); } }
<div class="low"></div> <div class="high"></div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.