Wed Jul 20 2022

Star Drawing

CSS1537 views

File Name: star-design.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Star</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        body { background-color: #292929; }

        section {
            width: 100%;
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .star {
            position: relative;
            border-left: 100px solid transparent;
            border-right: 100px solid transparent;
            border-bottom: 70px solid gold;
            transform: rotate(35deg);
        }

        .star::before {
            position: absolute;
            content: '';
            top: -45px;
            left: -65px;
            border-left: 30px solid transparent;
            border-right: 30px solid transparent;
            border-bottom: 80px solid gold;
            transform: rotate(-35deg);
        }

        .star::after {
            position: absolute;
            content: '';
            top: 3px;
            left: -105px;
            border-left: 100px solid transparent;
            border-right: 100px solid transparent;
            border-bottom: 70px solid gold;
            transform: rotate(-70deg);
        }
    </style>
</head>
<body>
    <section>
        <div class="star"></div>
    </section>
</body>
</html>

Result Screenshot(s)

Star DrawingWorking Sample0

We use cookies to improve your experience on our site and to show you personalised advertising. Please read our cookie policy and privacy policy.