Oct. 18, 2023, 3:08 p.m. | Sridhar Murali

DEV Community dev.to

Yes, I created a realistic moon using just CSS.

Let's dive right into the step by step process.


Add a div element into your HTML file and give a class name.


<div class="animated-moon"></div>


Now let's start the craft using CSS:

Start out by giving a basic shape to the element.



  width: 20rem;
height: 20rem;
position: absolute;
border-radius: 50%;


Here's an image from Solar System Scope with a moon texture :


https://www.solarsystemscope.com/textures/download/2k_moon.jpg


Add this as background image for your element and …

animated animation basic css design frontend giving html moon process

Data Architect

@ University of Texas at Austin | Austin, TX

Data ETL Engineer

@ University of Texas at Austin | Austin, TX

Lead GNSS Data Scientist

@ Lurra Systems | Melbourne

Senior Machine Learning Engineer (MLOps)

@ Promaton | Remote, Europe

AIML - Sr Machine Learning Engineer, Data and ML Innovation

@ Apple | Seattle, WA, United States

Senior Data Engineer

@ Palta | Palta Cyprus, Palta Warsaw, Palta remote