CSS: Percentage centering input with padding - HTML CSS CSS Form

HTML CSS examples for CSS Form:input

Description

CSS: Percentage centering input with padding

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">
.container {<!--  ww  w.ja  va 2 s .  c  o m-->
   width:81%;
   margin-left:11%;
   margin-right:11%;
   position:relative;
   outline:2px solid red;
}

.input {
   width:100%;
   padding:11px 16px 11px 31px;
   -moz-box-sizing:border-box;
   box-sizing:border-box;
}

#p1_icon {
   position:absolute;
   top:10px;
   left:8px;
}
</style> 
 </head> 
 <body> 
  <div class="container"> 
   <a id="p1_icon"></a> 
   <input id="p1" class="input" name="p1" type="password" placeholder="Password"> 
  </div>  
 </body>
</html>

Related Tutorials