JSFiddle - React, Tailwind, and code Playground
by Marc Malignan
HTML
<div class="galaxy">
<div class="planet mercury"></div>
<div class="planet venus"></div>
<div class="planet earth"></div>
<div class="planet mars"></div>
</div>
CSS
@-webkit-keyframes spin {
/*100% { -webkit-transform: rotate(360deg); }*/
}
body { background:rgb(50,50,50); margin: 80px; }
.galaxy {
position: relative;
margin-top: 200px;
}
.galaxy:before {
content: '';
position: absolute;
width:50px; height:50px;
top:50%; left:50%;
margin: -25px 0 0 -25px;
background: orange;
box-shadow: 0 0 20px orange;
border-radius: 50%;
}
.planet {
position: absolute;
top:50%; left:50%;
border: 1px solid gray;
}
.planet:after {
content: '';
position: absolute;
border-radius: 50%;
}
.planet.mercury {
width:80px; height:80px;
margin: -40px 0 0 -40px;
-webkit-animation: spin .87s linear infinite;
}
.planet.mercury:after {
width: 12px; height: 12px;
top:-6px; left:-6px;
background: gray;
}
.planet.venus {
width:160px; height:160px;
margin: -80px 0 0 -80px;
-webkit-animation: spin 2.24s linear infinite;
}
.planet.venus:after {
width: 20px; height: 20px;
top:-10px; left:-10px;
background: tan;
}
.planet.earth {
width:240px; height:240px;
margin: -120px 0 0 -120px;
-webkit-animation: spin 3.65s linear infinite;
}
.planet.earth:after {
width: 30px; height: 30px;
top:-15px; left:-15px;
background: royalblue;
}
.planet.mars {
width:320px; height:320px;
margin: -160px 0 0 -160px;
-webkit-animation: spin 6.86s linear infinite;
}
.planet.mars:after {
width: 46px; height: 46px;
top:-23px; left:-23px;
background: orangered;
}