Creating a cascading animation on text

For a slogan or for an animation on a very important page of your project, this very modern effect is also very easy to achieve. Let's take a look at how to do it in this article.
•
Updated on August 14, 2026
•
2 min read
Believemy logo

For a slogan or for an animation on a very important page of your project, this very modern effect is also very simple to achieve. Let's analyze together how to do it in this article.

Image

 

Step 1

The HTML code.

HTML
Render 
<div id="flip">
  <div><div>passionate</div></div>
  <div><div>easy</div></div>
  <div><div>accessible</div></div>
</div>
web dev

We have a lot of div tags, yes, but they allow us not to bloat the code with classes on every line.

 

Step 2

Let's style the page.

CSS
* {
  margin: 0; padding: 0;
  box-sizing: border-box;
}

body {
  font-family: arial, sans-serif;
  background: #131416;
  display: flex; align-items: center;
  justify-content: center;
  height: 100vh; color: #fff;
  flex-direction: column;
  font-size: 36px; font-weight: bold;
  text-transform: uppercase;
}

 

Step 3

Let's continue with the divs and the id flip.

CSS
#flip {
  height: 50px;
  overflow: hidden;
  text-align: center;
}

#flip > div > div {
  padding: 4px 12px;
  height: 50px;
  margin-bottom: 45px;
  display: inline-block;
}

In this step, we define the height of the area that will display each of the written words one after the other.

We use overflow: hidden to hide the other words so that only one is shown.

 

Step 4

Let's style each div to give it a different background.

CSS
#flip div:first-child {
  animation: show 5s linear infinite;
}

#flip div div {
  background: #42c58a;
}
#flip div:first-child div {
  background: #4ec7f3;
}
#flip div:last-child div {
  background: #DC143C;
}

For 5 seconds, we will play with margin-top and the height of the flip class to display each word.

Step 5

Let's create the show animation to finish.

CSS
@keyframes show {
  0% {margin-top: -270px;}
  5% {margin-top: -180px;}
  33% {margin-top: -180px;}
  38% {margin-top: -90px;}
  66% {margin-top: -90px;}
  71% {margin-top: 0px;}
  99.99% {margin-top: 0px;}
  100% {margin-top: -270px;}
}

For 5 seconds, we will play with margin-top and the height of the flip class to display each word.

Category: Developers

Share this article

Want to help us? Share this article on your networks or even better: on your site, in an article or in your newsletter.

Believemy logo
Comments (0)

You need to be logged in to comment on this article: log in or sign up.

Read next

Creating an animated list with CSS

Let's find out how to create an animated hover list!

December 9, 2024

Create a text rotation effect

To make your site more attractive, you could add this cool effect, which will display several words in succession with a looping deletion and rewriting effect. This effect can be placed at the end of a sentence, as in a text.

December 11, 2024

Create an animated 3D button using CSS

In this article, we'll find out how to create a three-dimensional button that will add a touch of softness and perspective to your projects!

December 9, 2024

Creating animated presentation cards with JavaScript

Whether you're presenting the team behind your project or anything else, using animated presentation cards will give your page a successful finishing touch. Find out how in this article!

December 9, 2024

Create an animated gradient background on hover avec CSS

Whether it's to highlight a part of your website or a quote as in this example, generating and adding a gradient to the background can give your website a very modern touch. Find out in this article how to do it easily!

December 9, 2024

Create a menu that spans the entire page using CSS

From time to time we have to ask our visitors which page they want to go to, by displaying the main sections of our website. This menu is often not very pleasant to use, so let's find out together in this article how to make it much more modern, with beautiful animations that will make your passers-by want to visit your site!

December 9, 2024

Creating text with integrated background

If you're looking for a very modern and effective way to style your headlines, take a look at how using a background to style the colour of your text can be incredibly innovative.

December 9, 2024

Create an animated "rainbow" button with CSS

In this article, we'll show you how to create a rainbow button that comes to life when the mouse hovers over it. A modern and sensational effect guaranteed!

December 9, 2024

Become the solopreneur you dream of being.

First project, career change, business launch: access our courses, practice on real-world cases, and move forward with clear guidance.