Neon Glitch Text

How to Create a Neon Glitch Text Effect with HTML and CSS

html

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="style.css">
    <title>Glitch text Effect Neon</title>
</head>

<body>
    <div class="cyber-text" data-text="SYSTEM ONLINE">SYSTEM ONLINE</div>

</body>

</html>

css

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #000;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    font-family: 'Courier New', monospace;
}

.cyber-text {
    font-size: 70px;
    color: #0FF;
    position: relative;
    text-transform: uppercase;
    letter-spacing: 5px;
    animation: float 3s ease-in-out infinite;
    text-shadow:
        0 0 5px #0FF,
        0 0 10px #0FF,
        0 0 20px #0FF,
        0 0 40px #0FF;

    &::before,
    &::after {
        content: attr(data-text);
        width: 100%;
        position: absolute;
        left: 0;
        overflow: hidden;
        color: #0FF;
        background: #000;
        clip-path: polygon(0 0, 100% 0, 100% 40%, 0 40%);
    }
}

.cyber-text::before {
    top: 0;
    animation: glitchTop 2s infinite linear alternate-reverse;
}

.cyber-text::after {
    bottom: 0;
    clip-path: polygon(0 60%, 100% 60%, 100% 100%, 0 100%);
    animation: glitchBottom 3s infinite linear alternate;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes glitchTop {
    0% {
        transform: translate(0, 0);
    }

    20% {
        transform: translate(-2px, -1px);
    }

    40% {
        transform: translate(2px, 1px);
    }

    60% {
        transform: translate(-1px, -2px);
    }

    80% {
        transform: translate(1px, 1px);
    }

    100% {
        transform: translate(0, 0);
    }
}

@keyframes glitchBottom {
    0% {
        transform: translate(0, 0);
    }

    20% {
        transform: translate(2px, 1px);
    }

    40% {
        transform: translate(-2px, -1px);
    }

    60% {
        transform: translate(1px, 2px);
    }

    80% {
        transform: translate(-1px, -1px);
    }

    100% {
        transform: translate(0, 0);
    }
}