Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Blink a text inside div twice using css

Tags:

css

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

like image 358
user3797053 Avatar asked Aug 28 '26 09:08

user3797053


2 Answers

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>
like image 89
Temani Afif Avatar answered Aug 31 '26 02:08

Temani Afif


#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

like image 26
Talut TASGIRAN Avatar answered Aug 31 '26 00:08

Talut TASGIRAN