DEV Community

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

Posted on • Edited on

3 1 2

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.

SurveyJS custom survey software

Simplify data collection in your JS app with a fully integrated form management platform. Includes support for custom question types, skip logic, integrated CCS editor, PDF export, real-time analytics & more. Integrates with any backend system, giving you full control over your data and no user limits.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs