Animated Background

Home / Web Code Snippet / Animated Background

Animated Background


https://youtube.com/shorts/ccjEzlm3TRM?si=whRRFT2aa-Z5ie6h

HTML CODE:-

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title></title>
</head>
<body>
<div class="container">
    <h1>Saksham Digital</h1>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
</div>
</body>
</html>

CSS CODE:-

 body{
            margin: 0px;
            padding: 0px;
        }
        .container{
            position: relative;
            background: black;
            width: 100%;
            height:100vh;
            overflow: hidden;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        h1{
            color: #333;
            font-size: 60px;
        }
        span{
            position: absolute;
            bottom: -150px;
            display: block;
            width: 30px;
            height: 30px;
            border-radius: 10px;
            box-shadow: 0px 0px 10px blue,0px 0px 20px blue;
            animation: animate 20s linear infinite;
        }
        span:nth-child(1){
            left: 25%;
            width: 60px;
            height: 60px;
            animation-delay: 0s;
        }
        span:nth-child(2){
            left: 10%;
            width: 30px;
            height: 30px;
            animation-delay: 2s;
            animation-duration: 12s;
        }
        span:nth-child(3){
            left: 70%;
            width: 30px;
            height: 30px;
            animation-delay: 4s;
        }
        span:nth-child(4){
            left: 40%;
            width: 60px;
            height: 60px;
            animation-delay: 0s;
            animation-duration: 18s;
        }
        span:nth-child(5){
            left: 65%;
            width: 30px;
            height: 30px;
            animation-delay: 0s;
        }
        span:nth-child(6){
            left: 75%;
            width: 100px;
            height: 100px;
            animation-delay: 3s;
        }
        span:nth-child(7){
            left: 45%;
            width: 130px;
            height: 130px;
            animation-delay: 7s;
        }
        span:nth-child(8){
            left: 50%;
            width: 35px;
            height: 35px;
            animation-delay: 15s;
            animation-duration: 30s;
        }
        span:nth-child(9){
            left: 20%;
            width: 25px;
            height: 25px;
            animation-delay: 2s;
            animation-duration: 25s;
        }
        span:nth-child(10){
            left: 85%;
            width: 130px;
            height: 130px;
            animation-delay: 0s;
            animation-duration: 11s;
        }
        @keyframes animate{
        0%{
            transform: translateY(0) rotate(0deg);
            opacity: 1;
        }
        100%{
            transform: translateY(-1000px) rotate(360deg);
            opacity: 0;
        }
    }