3

How can i blink a text twice every 5 second using css

i have a div

<div class="blink">text</div>

I want to blink this text twice every 5 second using css

how can i achieve this?

i tried this

how to make CSS animation to play every 10 seconds

but not working in ie

i want this to work in ie and chrome

user3797053
  • 497
  • 1
  • 8
  • 18

2 Answers2

5

Use animation and adjust the properties like below:

.blink {
  color:black;
  font-size:30px;
  font-weight:bold;
  animation:blink 2.5s linear infinite alternate 2.5s;

}

@keyframes blink {
  80% {
    color:black;
  }
  90% {
    color:red;
  }
  100% {
    color:black;
  }
}
<div class="blink">This text will blink twice every 5 seconds</div>
Temani Afif
  • 245,468
  • 26
  • 309
  • 415
4

#text {
  font-weight: bold;
  font-size: 20px;
  animation-name: blink;
  animation-duration: 5s;
   animation-iteration-count: infinite;
}

@keyframes blink {
    0% {color: pink}
    50% {color: black;}
    100% {color: pink;}
    }
<div id="text">
  No more lights
</div>

You can see CSS3 animation examples / attributes in here : https://www.w3schools.com/css/css3_animations.asp

Also another StackOverFlow post is here: https://stackoverflow.com/a/16012979/3366361

Talut TASGIRAN
  • 365
  • 4
  • 20