Happy New Year 2022 Text Animation With HTML CSS JavaScript

In this tutorial we will see how to make a Happy New Year 2022 Text Animation With HTML CSS JavaScript. Pure CSS and Vanilla JavaScript is used to make this css text animation effect.

HTML Code

Take a look at the HTML code given below.

<p><span>H</span><span>a</span><span>p</span><span>p</span><span>y</span> <span>N</span><span>e</span><span>w</span> <span>Y</span><span>e</span><span>a</span><span>r</span></p>    

CSS Code

CSS code is given below.

<style>      
body
{
    margin: 0;
    padding: 0;
    background-color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    font-family: 'Barlow Condensed' , sans-serif;
}
p
{
    font-size: 120px;
    font-weight: bold;
    text-align: center;
    color: #333;
}
span
{
    cursor: pointer;
}
.animation
{
    color: yellow;
    text-shadow: 0 0 10px yellow, 0 0 25px yellow;
    animation: glow 1.5s linear infinite;
}
@keyframes glow
{
    0%
    {
    filter: hue-rotate(0deg);
    }
    100%
    {
    filter: hue-rotate(360deg);
    }
}
</style>           

JavaScript Code

Take a look at the JavaScript Code given below.

<script>
var elem = document.getElementsByTagName('span');
for(var i =0; i < elem.length; i++)
{
elem[i].addEventListener('click' , function(){

if(this.classList.contains('animation'))    
{  
this.classList.remove('animation');
}
else 
{  
this.classList.add('animation');
}    
});   
}
</script>

Demo

Video Tutorial

Watch our video tutorial on Happy New Year 2022 Text Animation With HTML CSS JavaScript.

Responsive Sidebar Menu with CSS and JavaScript Cool CSS Button with Hover Animation Pure CSS Custom Radio Buttons Custom Emoji Radio Buttons with CSS Color Picker Design with HTML CSS and JavaScript Custom Radio Buttons with CSS Engraved HTML Buttons With CSS Neumorphic Buttons Design with CSS Cool Profile Card Design with HTML CSS Neumorphic Search Bar Design with HTML and CSS Simple Login Form with Placeholder Animation Pure CSS Button with Folded Corner Background Color Change Slider with HTML CSS and JavaScript 404 Page Not Found Template Design with HTML and CSS Movies Blog Card Design with HTML and CSS Simple CSS Border Animation with before and after Selector Custom Social Select Dropdown Menu with CSS and JavaScript Facebook Offline and Online Notification with CSS and JS New Year 2022 Text Animation with CSS and JS Change Placeholder Color using CSS Custom Select Tag DropDown with CSS and JavaScript Simple Price Range Slider With HTML CSS and JavaScript Profile Card With Hover Effect using HTML and CSS Circle With Two Colors using CSS Simple FAQ Accordion With HTML CSS and JavaScript
Change Text Color On Hover with JavaScript Hide and Show div using JavaScript Get Button text with JavaScript Get textarea value with JavaScript Get table row Height with JavaScript Auto Increase width of input field with JavaScript Set Textarea maxLength with JavaScript Set Textarea Value with JavaScript JavaScript Count list items JavaScript set input field value Count Button Clicks with JavaScript Scroll Page to the Top on Click with JavaScript Change id of Element with JavaScript JavaScript Change li Text Color JavaScript Change li Text JavaScript Remove id from Element Check If id Exists in JavaScript How To Delete Table Row by id in JavaScript Update Textarea value in JavaScript Change Variable Value in JavaScript Uncheck Radio Button Dynamically JavaScript Check Radio Button Dynamically JavaScript JavaScript Check if Radio Button is Checked or Not Change h1 Tag Text with JavaScript Remove First li from ul JavaScript