Happy Holi using HTML and CSS

happy holi

Happy Holi using HTML and CSS

In this blog, we will write a HTML to create Happy Holi page with Animation

Let's start..


Create a HTML file and write this code in the file

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>Happy Holi</title>
    <link rel="stylesheet" href="happy-holi.css">
</head>
            
<body>
    <div>
        <h1>Happy Holi</h1>
    </div>
            
    <ul>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
    </ul>
</body>
            
</html>           
        
    

Now add CSS in it, you can add CSS in the HTML file or you can create another CSS file and then link it in your HTML file.

Here I created CSS file and linked it here.

Now write the CSS

CSS

        
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@500&display=swap');
body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    font-family: 'Nunito', sans-serif;
}
            
div {
    position: relative;
    z-index: 1;
}
            
h1 {
    margin: 0;
    padding: 0;
    font-size: 9em;
    color: #fff;
    filter: blur(1px);
    animation: fontColor 3s linear infinite;
}
            
            
/* Animation for 'Happy Holi' text */
            
@keyframes fontColor {
    0% {
        color: rgb(255, 0, 0);
    }
    20% {
        color: rgb(70, 70, 233);
    }
    40% {
        color: rgb(78, 231, 78);
    }
    60% {
        color: rgb(255, 255, 0);
    }
    80% {
        color: rgb(247, 82, 247);
    }
    100% {
        color: rgb(135, 206, 235);
    }
}
            
ul {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}
            
ul li {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    list-style: none;
    background: #000;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    filter: blur(5px);
}
            
ul li:nth-child(odd) {
    animation: animateOdd 6s linear infinite;
}
            
            
/* Animation for color bubbles */
            
@keyframes animateOdd {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translate(300px, -600px) scale(12);
        opacity: 0;
    }
}
            
ul li:nth-child(even) {
    animation: animateEven 6s linear infinite;
}
            
@keyframes animateEven {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translate(-300px, -600px) scale(12);
        opacity: 0;
    }
}
            
ul li:nth-child(1) {
    animation-delay: 0s;
    background: rgb(255, 0, 0);
}
            
ul li:nth-child(2) {
    animation-delay: 1s;
    background: rgb(70, 70, 233);
}
            
ul li:nth-child(3) {
    animation-delay: 2s;
    background: rgb(78, 231, 78);
}
            
ul li:nth-child(4) {
    animation-delay: 3s;
    background: rgb(255, 255, 0);
}
            
ul li:nth-child(5) {
    animation-delay: 4s;
    background: rgb(247, 82, 247);
}
            
ul li:nth-child(6) {
    animation-delay: 5s;
    background: rgb(135, 206, 235);
}           
        
    

Now save this and you are done..

You can see output in your browser


Output




Join Our Social Media Connections

Post a Comment

0 Comments