Centre a form and its labels in HTML/CSS - HTML CSS CSS Form

HTML CSS examples for CSS Form:Form

Description

Centre a form and its labels in HTML/CSS

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">
label {<!--from   ww w  .ja v a  2 s.  c o  m-->
   width:121px;
   padding-right:11px;
}

input, textarea {
   width:181px;
   margin-bottom:6px;
}

#loginbutton {
   margin-left:121px;
   margin-top:6px;
   width:91px;
}

#form {
   text-align:center;
   position:relative;
   top:100px;
}
</style> 
 </head> 
 <body> 
  <div id="form"> 
   <form action="entryformlogon.php" method="post"> 
    <label for="user">Lorem ip</label> 
    <input type="text" name="Username"> 
    <br> 
    <label for="password">Lorem ip</label> 
    <input type="password" name="Password"> 
    <br> 
    <input type="submit" name="loginbutton" value="Log in"> 
   </form> 
  </div>  
 </body>
</html>

Related Tutorials