vertical align html form

You can also go for this:

HTML

<div id="main" >
   <form id="frm" action="save_thought.php" method="post">
      <input type="text" name="thought"><br>
      <input type="submit" value="Submit">
   </form>
</div>

CSS

#main
{
  line-height: 400px;
  text-align:center; 
  vertical-align:middle;
}

#frm
{
  display: inline-block;
  vertical-align: middle;
  line-height: 14px; 
}

Demo Here


You can use position:absolute DEMO http://jsfiddle.net/kevinPHPkevin/U8dZr/

div#form-wrapper {
    position:absolute;
    top:50%;
    right:0;
    left:0;
}

Tags:

Html

Css