<div class="form-group"> <h2>Please enter the password</h2> <p>Your browser must accept cookies in order to log in.</p> <input type="password" name="password" size="15"> <input type="submit" value="login"> </div> 整个页面上下左右都居中
.form-group{ position:absolute; width:300px; height:200px; top:50%; left:50%; margin-top:-100px; margin-left:-150px; }