<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>css彈窗遮罩效果</title>
</head>
<style>
.main{
margin: 0 auto;
width: 1024px;
height: 1024px;
background: url(img/background.png) repeat-y;
position: relative;
bottom: 30px;
top: 30px;
}
.mask{
width: 100%;
height: 100%;
opacity: .3;
filter: alpha(opacity=30);
background-color: #000;
position: fixed;
left: 0;
top: 0;
}
.login{
width: 300px;
height: 300px;
background: url(img/login.png) no-repeat;
position: fixed;
top: 50%;
margin-top: -150px;
left: 50%;
margin-left: -150px;
}
</style>
<body>
<div class="main"></div>
<div class='mask'></div>
<div class='login'></div>
</body>
</html>