Text Animation with changing the color of the text using HTML and CSS Last Updated : 16 Jan, 2024 Comments Improve Suggest changes Like Article Like Report Text animation is the creation of beautiful and colorful letters, words, and paragraphs with a decorative movable effect. The movement can be seen in some fashion within the area or across the screen following some regular pattern. The @keyframes in CSS allows defining a series of animations at specific points during an animation sequence. In this styles are declared for different stages of the animation, enabling dynamic transitions and effects. Syntax for @keyframes:@keyframes animationname {keyframes-selector {css-styles;}} Approach:First, create an HTML file with a container div and two span elements for the text.Apply styles for the container, text1, and text2, setting initial appearances.Define font size, color, spacing, and positioning for text1 and text2.Use @keyframes to specify color and letter-spacing changes at different animation stages.Apply the animation to text1 within the container, creating a 3-second effect with color and letter-spacing variations.Example: HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Text Animation</title> <style> * { padding: 0; margin: 0; font-family: sans-serif; } body { background: yellowgreen; } .container { text-align: center; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 100%; } .container span { display: block; } .text1 { color: white; font-size: 70px; font-weight: 700; letter-spacing: 8px; margin-bottom: 20px; background: yellowgreen; position: relative; animation: text 3s 1; } .text2 { font-size: 30px; color: darkgreen; font-family: Georgia, serif; } @keyframes text { 0% { color: black; margin-bottom: -40px; } 30% { letter-spacing: 25px; margin-bottom: -40px; } 85% { letter-spacing: 8px; margin-bottom: -40px; } } </style> </head> <body> <div class="container"> <div class="row"> <span class="text1">Hello!</span> <span class="text2">GeeksforGeeks</span> </div> </div> </body> </html> Output: Comment More infoAdvertise with us Next Article Text Animation with changing the color of the text using HTML and CSS nehaahlawat Follow Improve Article Tags : Web Technologies Web Templates QA - Placement Quizzes-Data Interpretation Volkswagen IT Services Similar Reads JavaScript Tutorial JavaScript is a programming language used to create dynamic content for websites. It is a lightweight, cross-platform, and single-threaded programming language. It's an interpreted language that executes code line by line, providing more flexibility.JavaScript on Client Side: On the client side, Jav 11 min read Web Development Web development is the process of creating, building, and maintaining websites and web applications. It involves everything from web design to programming and database management. Web development is generally divided into three core areas: Frontend Development, Backend Development, and Full Stack De 5 min read React Interview Questions and Answers React is an efficient, flexible, and open-source JavaScript library that allows developers to create simple, fast, and scalable web applications. Jordan Walke, a software engineer who was working for Facebook, created React. Developers with a JavaScript background can easily develop web applications 15+ min read JavaScript Interview Questions and Answers JavaScript (JS) is the most popular lightweight, scripting, and interpreted programming language. JavaScript is well-known as a scripting language for web pages, mobile apps, web servers, and many other platforms. Both front-end and back-end developers need to have a strong command of JavaScript, as 15+ min read React Tutorial React is a JavaScript Library known for front-end development (or user interface). It is popular due to its component-based architecture, Single Page Applications (SPAs), and Virtual DOM for building web applications that are fast, efficient, and scalable.Applications are built using reusable compon 8 min read CPU Scheduling in Operating Systems CPU scheduling is a process used by the operating system to decide which task or process gets to use the CPU at a particular time. This is important because a CPU can only handle one task at a time, but there are usually many tasks that need to be processed. The following are different purposes of a 8 min read Domain Name System (DNS) DNS is a hierarchical and distributed naming system that translates domain names into IP addresses. When you type a domain name like www.geeksforgeeks.org into your browser, DNS ensures that the request reaches the correct server by resolving the domain to its corresponding IP address.Without DNS, w 8 min read What Is Cloud Computing ? Types, Architecture, Examples and Benefits Nowadays, Cloud computing is adopted by every company, whether it is an MNC or a startup many are still migrating towards it because of the cost-cutting, lesser maintenance, and the increased capacity of the data with the help of servers maintained by the cloud providers. Cloud Computing means stori 15 min read NodeJS Interview Questions and Answers NodeJS is one of the most popular runtime environments, known for its efficiency, scalability, and ability to handle asynchronous operations. It is built on Chromeâs V8 JavaScript engine for executing JavaScript code outside of a browser. It is extensively used by top companies such as LinkedIn, Net 15+ min read HTML Interview Questions and Answers HTML (HyperText Markup Language) is the foundational language for creating web pages and web applications. Whether you're a fresher or an experienced professional, preparing for an HTML interview requires a solid understanding of both basic and advanced concepts. Below is a curated list of 50+ HTML 14 min read Like