我想通过以下方式绝对化 div,但由于某种原因,Firefox 将 div 推到最顶部,因此它水平居中,但垂直居中。铬工作正常
HTML:
<body>
<div id="login">
<div id="header">ict <span class="redText">recruit</span></div>
<div id="wrapper">
<div class="page-header">
<h1>Login</h1>
</div>
<div id="loginBox">
<div class="control-group" id="Div1">
<div class="controls">
<label class="control-label" for="firstName1">Password</label>
</div>
</div>
<div class="control-group" id="firstName1g">
<label class="control-label" for="firstName1">Password</label>
</div>
</div>
</div>
</div>
</body>
CSS:
#login{
position: relative;
text-align:center;
width: 100%;
height: 100%;
display: block;
}
#header {
position:relative;
text-align: left;
padding-left: 50px;
width: 100%;
height: 50px;
border-bottom: 3px solid #dc0000;
font-family: Leelawadee, sans-serif;
font-size: 30px;
line-height: 50px;
}
.redText {
color: rgb(220,0,0);
}
#wrapper {
margin: 0 auto;
position: relative;
width: 400px;
height: 400px;
top: 50%;
left: 50%;
margin-top: -200px;
margin-left: -200px;
text-align: left;
}
div.page-header h1 {
font-family: Leelawadee, sans-serif;
font-weight: 300;
display: inline-block;
padding-bottom: 10px;
border-bottom: 3px solid #dc0000;
}
#loginBox {
position: relative;
width: 100%;
height: 100%;
padding: 30px;
background: #e5e5e5;
-moz-border-radius: 15px;
-webkit-border-radius: 15px;
border-radius: 15px;
}