Menu
Coddy logo textTech

moon class pseudo-element

Lesson 8 of 10 in Coddy's Solar Eclipse Animation | HTML/CSS Project course.

challenge icon

Challenge

Easy

In the CSS file, target the moon class and use ::before pseudo-element,

  1. Set the content of this element to "" (Empty string).
  2. Set the background-color to rgba(0, 0, 0, 0).
  3. Set the border-radius of 50%.
  4. Set the z-index of -1.
  5. Set the width and height to 100%.
  6. Set the position to absolute and set display to block.
  7. Add animation named "eclipse-animation", which will run over every 3.2s in linear , infinite and alternate state.

Try it yourself

<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href="styles.css">
</head>
    <body>
        <!-- Write HTML code here -->
        <script src="script.js"></script>
    </body>
</html>

All lessons in Solar Eclipse Animation | HTML/CSS Project