我的这个弹出层怎么不能居中啊,哪位大神指点一下,在线等
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>登录</title>
</head>
<body>
<style type="text/css">
body {
margin: 0px;
padding: 0
}
#div1 {
display: none;
position: absolute;
z-index: 1000;
height: 100%;
width: 100%;
background: #000000;
filter: Alpha(opacity = 30);
}
#div2 {
display: none;
position: absolute;
height: 100%;
width: 100%;
padding-top: 10%;
z-index: 1001;
left: 0px;
top: 0px;
}
#title{
width:350px;
height:75px;
text-align:center;
font-size:25px;
float:left;
}
#close{
width:20px;
height:20px;
text-align:center;
float:right;
}
#login
{
height:260px;
width:560px;
border:2px;
background: #ff7300;
position:static;
filter:progid:DXImageTransform.Microsoft.DropShadow(color=#666666,offX=4,offY=4,positives=true);
margin:0px auto;
}
.div{text-align:center}
</style>
<script>
function openme() {
document.getElementById('div1').style.display = 'block';
document.getElementById('div2').style.display = 'block';
}
function closeme() {
document.getElementById('div1').style.display = 'none';
document.getElementById('div2').style.display = 'none';
}
//function logo_in(){alert()
//验证
//转向...
//myform.action=""
//myform.submit()
//closeme();
//}
function checkLogin() {
if (document.loginform.userEmail.value == "") {
alert("邮箱不能为空");
document.loginform.userEmail.foucs();
return false;
}
if (document.loginform.userPwd.value == "") {
alert("密码不能为空");
document.loginform.userPwd.foucs();
return false;
}
return true;
}
</script>
<div id="div1"></div>
<div id="div2">
<div id="login" >
</div>
</div>
<div>
<input name="button" type="button" onClick="openme()" value="登陆" />
</div>
<br>
<div>
背面
</div>
</body>
</html>
------解决方案--------------------.div{text-align:center}
把div前面那个点 去了 就可以!!!
------解决方案--------------------1楼说的对
div{text-align:center}
没有 .