How to make blink div in html and css

In this tutorial, I am going to show how to div blink using HTML and CSS 


For blinking div, first setting opacity: 1; and then you are ending it on 0, so it starts from 0% and ends on 100%, so instead just set the opacity to 0 at 50% and the rest will take care of itself.

let's see the below example:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, 
    initial-scale=1">
  <title>Div Blinking</title>
  <style>
    .blink {
  animation: blinker 1s linear infinite;
  background:red;
  color:white;
   width:100px;
  font-weight:bold;
}

@keyframes blinker {
  50% {
    opacity: 0;
  }
}
  </style>
</head>
<body>
<div class="blink">Iam Blinking</div>  
</body>
</html>


Result






Reactions

Post a Comment

0 Comments