1

I am working with CSS, and want to do an effect where an object is moving around another object in an ellipse. I am not using a canvas, and this is my 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? Thanks for your help!

Contradictions
  • 137
  • 3
  • 15

1 Answers1

1

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>
Praveen Kumar Purushothaman
  • 164,888
  • 24
  • 203
  • 252