How to Create Text Color Animation using HTML and CSS ? Last Updated : 30 Jan, 2024 Comments Improve Suggest changes Like Article Like Report The text color can be changed according to the programmer’s choice using CSS @keyframes rule. In this article, we will see how to create text color animation using HTML and CSS. Preview:Approach:Create an HTML file with a centered <div> containing an <h2> element.Use CSS to reset default margin and padding for the body.Center the <div> element using absolute positioning and 'transform'.Style <h2> with desired properties and apply a color animation using keyframes.Create a gradient background animation within keyframes, and use '-webkit-background-clip' for text clipping. HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Text Color Animation</title> <style> body { margin: 0; padding: 0; } div { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); } h2 { font-size: 5em; font-family: serif; color: transparent; text-align: center; animation: effect 2s linear infinite; } @keyframes effect { 0% { background: linear-gradient(#008000, #00FF00); -webkit-background-clip: text; } 100% { background: linear-gradient(#3CE7D7, #000FFF); -webkit-background-clip: text; } } </style> </head> <body> <div> <h2>GeeksforGeeks</h2> </div> </body> </html> Output: Comment More infoAdvertise with us Next Article How to Create Text Color Animation using HTML and CSS ? L lakshgoel204 Follow Improve Article Tags : Web Technologies Web Templates Similar Reads How to create a progress bar animation using HTML and CSS ? In this mini Web Development project we will utilize CSS animations and create a progress bar using them. The progress bar will start from zero and go to a certain extent as we want. The progress bar is basically showing the expertise of a programmer in different languages in animated form. Prerequi 3 min read How to Create Loading Blur Text Animation Effect using HTML and CSS? The blur text animation is known as the Smoky effect and is used to give the text a blurry animation. The text blurs linearly in one direction and then reappears. In this article, we will create a loading blur text animation effect using HTML and CSS.Approach: The approach to create loading blur tex 3 min read How to Create Typewriter Animation using HTML and CSS ? A typewriter animation simulates the appearance of text being typed out letter by letter, using only HTML and CSS. This effect is a simple yet eye-catching way to bring dynamic text to life on a website, capturing attention without the need for JavaScript. It's a great technique to make key text ele 6 min read How to create text-fill animation using CSS ? A text-fill animation using CSS is a visual effect where the content of text gradually fills with a color, gradient, or pattern over time. This animation can create dynamic, eye-catching effects for headings or titles by adjusting properties like background-size, clip-path, or keyframe animations.Ap 2 min read How to create animated banner links using HTML and CSS? Links are one of the most important parts of any component that is used in website making. Almost every component had some form of links in it. A common example is a menu/nav-bar. All we see is some button like home, about, etc. but under the hood they all are links. Sometimes there comes a situatio 2 min read Like