change position of input field when focused on - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Position

Description

change position of input field when focused on

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">
input {<!--from   ww w.  ja  v a 2 s .  c  o  m-->
   width:100%;
   top:301px;
   position:relative;
   transition:.5s all;
}

input:focus {
   top:0;
}
</style> 
 </head> 
 <body> 
  <div class="wrapper"> 
   <p>Lorem ipsum d</p> 
  </div> 
  <input type="text" class="bla" placeholder="put some text here">  
 </body>
</html>

Related Tutorials