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

Software Engineer for AI Training Data (School Specific)

@ G2i Inc | Remote

Software Engineer for AI Training Data (Python)

@ G2i Inc | Remote

Software Engineer for AI Training Data (Tier 2)

@ G2i Inc | Remote

Data Engineer

@ Lemon.io | Remote: Europe, LATAM, Canada, UK, Asia, Oceania

Artificial Intelligence – Bioinformatic Expert

@ University of Texas Medical Branch | Galveston, TX

Lead Developer (AI)

@ Cere Network | San Francisco, US