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
How to Change Image on Hover with JavaScript How to Disable Button by Class Name in JavaScript How To Change Image Size with JavaScript How to change Image opacity with JavaScript How to Change image src on click with JavaScript How to get the lang attribute value in JavaScript How to Get attribute Value using JavaScript How To Check if Attribute Exists or not with JavaScript How To Count number of links on Page with JavaScript How To Scroll Page to Bottom using JavaScript How To Detect Shift Key Press with 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