CSS

Loading text with linear gradient

Text loading animation using linear-gradient and clip text

3/8/2023
0 views
happy-holi.htmlHTML
<!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>Happy Holi</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=Secular+One&display=swap" rel="stylesheet">
    <style>
        :root {
            --pink: #ea00ff;
            --yellow: #cbf800;
            --green: #00ff25;
            --red: #ff0000;
        }

        * {
            margin: 0;
            padding: 0;
            font-family: 'Secular One', sans-serif;
        }

        body {
            background-color: #282828;
        }

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

        h1 {
            font-size: 80px;
            font-weight: 700;
            color: #363636;
            position: relative;
        }

        h1::before {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            content: attr(data-text);
            background-image: linear-gradient(30deg, var(--pink), var(--yellow), var(--green), var(--red));
            -webkit-background-clip: text;
            color: transparent;
            animation: loading 6s forwards cubic-bezier(0.175, 0.885, 0.32, 1.275);
        }   

        @keyframes loading {
            0% { height: 0;}
            20% { height: 45%;}
            80% { height: 75%;}
            90% { height: 85%;}
            100% { height: 100%;}
        }
        
    </style>
</head>
<body>
    <section>
        <h1 data-text="Happy Holi">Happy Holi</h1>
    </section>
</body>
</html>
CSSlinear-gradientloading animation

Loading comments...

Related Examples

Understanding CSS Shadows: box-shadow vs drop-shadow
CSS

Understanding CSS Shadows: box-shadow vs drop-shadow