Menu
Coddy logo textTech

Random Size

Lesson 9 of 18 in Coddy's Moving Clouds - HTML/CSS/JS Project course.

challenge icon

Challenge

Easy

Let's add a random size to the cloud.

To set different sizes for the cloud without changing everything, we can use transform and scale:

transform: scale(0.3)

The above will scale the element targeted to 0.3 from its original size!

In the JS file, add this style property programmatically and then make it random. The suggested sizes are between 0.3 and 1.

Make sure you are not deleting your previous code, making the random position!

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 Moving Clouds - HTML/CSS/JS Project