Centering a form without using width - HTML CSS CSS Form

HTML CSS examples for CSS Form:Form

Description

Centering a form without using width

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 {<!--from w  w w .j a  v a2s  .c o m-->
   text-align:center
}

form {
   display:inline-block;
   background-color:Chartreuse;
   padding:11px;
}
</style> 
 </head> 
 <body> 
  <form> 
   <input type="text"> 
   <input type="submit" value="submit"> 
  </form>  
 </body>
</html>

Related Tutorials