Flip Animation – CSS Animations

Hello guys in this tutorial we will create flip text animation using HTML and CSS

First we need to create two files index.html and style.css then we need to do code for it.

Step:1

Add below code inside index.html

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Fliping Text Animation</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta https-equiv="X-UA-Compatible" content="ie=edge" />
    <link rel="stylesheet" href="style.css" />
    <link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans&display=swap" rel="stylesheet">
  </head>
  <body>
    <div class="heading-outer">
      <h1 class="animated-heading">
        <span>L</span>
        <span>o</span>
        <span>a</span>
        <span>d</span>
        <span>i</span>
        <span>n</span>
        <span>g</span>
        <span>.</span>
        <span>.</span>
        <span>.</span>
      </h1>
    </div>
  </body>
</html>

Step:2

Then we need to add code for style.css which code i provide in below screen.

* {
  padding: 0;
  margin: 0;
  font-family: 'IBM Plex Sans', sans-serif;
}
body { background: #f1f2f3; }
.container {
    width: 95%;
    max-width: 1160px;
    margin: auto;
}
.heading-outer {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
}
.animated-heading {
    font-size: 50px;
    display: flex;
    -webkit-perspective: 700px;
    		perspective: 700px;
}
.animated-heading > span {
    animation: flip 2.5s linear infinite;
    transform-origin: 0 70%;
    color: #4b00ff;
    text-transform: uppercase;
    -webkit-transform-style: preserve-3d;
    		transform-style: preserve-3d;
    text-shadow: 0 0 1px rgba(0,0,0,0.1), 
    			 0 0 2px rgba(0,0,0,0.2), 
    			 0 0 3px rgba(0,0,0,0.3);
}
@keyframes flip {
	50% { transform: rotateX(360deg); }
	100% { transform: rotateX(360deg); }
}
.animated-heading > span:nth-child(2) {
	animation-delay: 0.3s
}
.animated-heading > span:nth-child(3) {
	animation-delay: 0.6s
}
.animated-heading > span:nth-child(4) {
	animation-delay: 0.9s
}
.animated-heading > span:nth-child(5) {
	animation-delay: 1.1s
}
.animated-heading > span:nth-child(6) {
	animation-delay: 1.4s
}
.animated-heading > span:nth-child(7) {
	animation-delay: 1.7s
}
.animated-heading > span:nth-child(8) {
	animation-delay: 2.1s
}
.animated-heading > span:nth-child(9) {
	animation-delay: 2.4s
}
.animated-heading > span:nth-child(10) {
	animation-delay: 2.7s
}

Output:

Leave a Comment