Tue Aug 02 2022

ZigZag Border

CSS1238 views

File Name: zigzag-border-in-css.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>Zig Zag Border</title>
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" rel="stylesheet"> 
    <style>
        * {
            margin: 0;
            padding: 0;
            font-family: 'Poppins', sans-serif;
        }

        body {
             background-color: #292929;
        }

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

        .ticket {
            width: 250px;
            height: 300px;
            background-color: #ffee00;
            position: relative;
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 40px;
            font-weight: bold;
            color: #292929;
        }
        
        .ticket::before {
            position: absolute;
            content: '';
            background: linear-gradient(-135deg, #292929 16px, transparent 0),
                        linear-gradient(135deg, #292929 16px, transparent 0);
            background-repeat: repeat-x;
            background-size: 32px;
            top: 0;
            left: 0;
            width: 100%;
            height: 32px;
        }

        .ticket::after {
            position: absolute;
            content: '';
            background: linear-gradient(-45deg, #292929 16px, transparent 0),
                        linear-gradient(45deg, #292929 16px, transparent 0);
            background-repeat: repeat-x;
            background-size: 32px;
            bottom: 0;
            left: 0;
            width: 100%;
            height: 32px;
        }
    </style>
</head>
<body>
    <section>
        <div class="ticket">
            Ticket
        </div>
    </section>
</body>
</html>

Result Screenshot(s)

ZigZag BorderWorking 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.