Animate Icon to input box - HTML CSS CSS Form

HTML CSS examples for CSS Form:input

Description

Animate Icon to input box

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
body {<!-- ww w.j a v a  2 s  . c  om-->
   text-align:center;
   background:Chartreuse;
}

#magnifying-glass {
   display:flex;
   justify-content:center;
   height:100px;
   width:100px;
   border-radius:100px;
   border:15px solid yellow;
   margin:0 auto;
   margin-top:201px;
   transition:2s;
}

#magnifying-glass::after {
   content:"";
   height:51px;
   width:15px;
   border-radius:11px;
   background-color:blue;
   transform:rotate(-46deg);
   position:relative;
   top:86px;
   left:51px;
   -webkit-transition:2s;
   -moz-transition:2s;
   -o-transition:2s;
   transition:2s;
}

input {
   display:none;
   border:none;
   width:71%;
   font-size:3.6em;
   border-radius:41px;
}

input:focus {
   outline:none;
}

#magnifying-glass:hover {
   width:301px;
}

#magnifying-glass:hover::after {
   transform:rotate(361deg);
   height:0;
   opacity:0;
}

#magnifying-glass:hover input {
   display:block;
}
</style> 
 </head> 
 <body> 
  <div id="magnifying-glass"> 
   <input type="text" placeholder="Search"> 
  </div>  
 </body>
</html>

Related Tutorials