CSS Blinking Text Animation

Web Design & Web Development

Demo

Sponsored links

 

Code

HTML

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>CSS Blinking Text Animation</title>
    <link rel="stylesheet" type="text/css" href="https://demo.plantpot.works/assets/css/normalize.css">
    <link rel="stylesheet" href="https://use.typekit.net/opg3wle.css">
    <link rel="stylesheet" type="text/css" href="style.css">
  </head>
  <body>
    <div id="container">
      <h1><span class="blink-01">Blinking </span><span class="blink-02">Text</span></h1>
    </div>
  </body>
</html>

CSS

@charset "utf-8";
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  font-size: 16px;
}
body {
  background-color: #000;
  font-family: futura-pt, sans-serif;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
}
#container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100vh;
}
h1 {
  font-size: 4rem;
}
.blink-01 {
  position: relative;
  animation: blink01 1s infinite alternate;
}
.blink-01::before {
  opacity: .5;
  position: absolute;
  top: 0;
  left: 0;
  z-index: -2;
  filter: blur(40px);
  width: 100%;
  height: 100%;
  content: '';
  animation: bg_blink01 1s infinite alternate;
}
.blink-01::after {
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1;
  filter: blur(20px);
  content: 'Blinking';
  animation: blink01 1s infinite alternate;
}
.blink-02 {
  position: relative;
  animation: blink02 1s infinite alternate;
}
.blink-02::before {
  opacity: .5;
  position: absolute;
  top: 0;
  left: 0;
  z-index: -2;
  filter: blur(40px);
  width: 100%;
  height: 100%;
  content: '';
  animation: bg_blink02 1s infinite alternate;
}
.blink-02::after {
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1;
  filter: blur(20px);
  content: 'Text';
  animation: blink02 1s infinite alternate;
}
@keyframes blink01 {
 0% {
   color: #efc137;
 }
 100% {
   color: #bafff4;
 }
}
@keyframes blink02 {
 0% {
   color: #bafff4;
 }
 100% {
   color: #efc137;
 }
}
@keyframes bg_blink01 {
 0% {
   filter: blur(40px);
   background-color: #efc137;
 }
 100% {
   filter: blur(40px);
   background-color: #bafff4;
 }
}
@keyframes bg_blink02 {
 0% {
   filter: blur(40px);
   background-color: #bafff4;
 }
 100% {
   filter: blur(40px);
   background-color: #efc137;
 }
}
@media screen and (max-width: 480px) {
  h1 {
    font-size: 2.25rem;
  }
}