Approach: The approach is to use keyframes to change word at a certain frame. The word can be set using the content property.
HTML Code: In this section, we have heading wrapped inside a <h1> tag. We also have a span which will populate later using CSS.
- Step 1: Do some basic style like background-color, text-color, margins, padding etc.
- Step 2: Now, use before select/or to set the content of span to an initial word.
- Step 3: Use animation property to set the total time for the animation.
- Step 4: Now, use keyframes to change the content property that was set in before selector for each frame.
Tip: You can set the total time according to need. But generally, it is recommended to use a time which is a multiple of the total number of words that you want to change. Like in our case, we have three words and we have used 3s as total time. You can use 6, 9, 12… so on. Setting time as multiple of the total number of words will ensure that each word gets displayed for an equal amount of time.
Complete Code: It is the combination of the above two sections of code.
- Text Animation with changing the color of the text using HTML & CSS
- How to Create Loading Blur Text Animation Effect using HTML and CSS ?
- How to Create Jumping Text 3D Animation Effect using CSS ?
- Loading Text Animation Effect using CSS
- How to Create Text Color Animation using HTML and CSS ?
- How to create text-fill animation using CSS ?
- How to Create Ghost Text Animation on Hover using HTML and CSS?
- How to Create Liquid Filing Effect on Text using HTML and CSS ?
- Create a 3D Text Effect using HTML and CSS
- How to Create Embossed Text Effect using CSS ?
- How to create text-reveal effect using HTML and CSS ?
- How To Create Carved Text Effect using CSS?
- How to Create Engraved Text Effect using HTML and CSS ?
- How to Create Text Reveal Effect for Buttons using HTML and CSS ?
- Create a Gradient Text Effect using HTML and CSS
- How to create multilayered text effect using HTML and CSS?
- How to create text stagger animation using TypographyMotion plugin ?
- Rubber Band Text animation using HTML and CSS
- How to create long shadow of text without using text-shadow in HTML and CSS ?
- Double Layered Text Effect using CSS
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.