Changing placeholder color in animation - HTML CSS CSS Animation

HTML CSS examples for CSS Animation:Color

Description

Changing placeholder color in animation

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <title>New Color Animation</title> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">

element {<!--from w  w w.j av a2s  .c om-->
   --main-text-color: rgba(0,0,255,0.8);
}
input, input::-webkit-input-placeholder {
   color: var(--main-text-color);
   -webkit-animation: anim 4s linear 1 forwards;
   animation: anim 4s linear 1 forwards;
}
@keyframes anim {
   0% {
      opacity: 0.2;
      --main-text-color: rgba(0,0,255,0.2);
   }
   70% {
      opacity: 1;
      --main-text-color: rgba(255,0,0,1);
   }
   100% {
      opacity: 0.1;
      --main-text-color: rgba(0,0,255,0.5);
   }
}


      </style> 
 </head> 
 <body> 
  <input type="text" placeholder="Hello">  
 </body>
</html>

Related Tutorials