DEV Community

Cover image for Creating CSS Art is a delightful challenge
Olatunji Ayodele Abidemi
Olatunji Ayodele Abidemi

Posted on • Edited on

Creating CSS Art is a delightful challenge

Creating CSS art is a delightful challenge. Here's a simple example of a CSS art representation of a smiley face:

Image description

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <style>
        .smiley {
            width: 100px;
            height: 100px;
            border: 2px solid black;
            border-radius: 50%;
            position: relative;
        }
        .eye {
            width: 20px;
            height: 20px;
            background-color: black;
            border-radius: 50%;
            position: absolute;
        }
        .left-eye {
            top: 30px;
            left: 30px;
        }
        .right-eye {
            top: 30px;
            right: 30px;
        }
        .mouth {
            width: 60px;
            height: 30px;
            border: 2px solid black;
            border-top-left-radius: 50px;
            border-top-right-radius: 50px;
            position: absolute;
            bottom: 20px;
            left: 20px;
        }
    </style>
</head>
<body>
    <div class="smiley">
        <div class="eye left-eye"></div>
        <div class="eye right-eye"></div>
        <div class="mouth"></div>
    </div>
</body>
</html>
Enter fullscreen mode Exit fullscreen mode

Image description

Image description
Feel free to customize the colors, sizes, and positions to create your own unique CSS Art.

Top comments (0)