您的位置:首页 > Web前端 > CSS

css 实现弹框

2013-11-21 21:25 218 查看
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style style="text/css">
.black_overlay{
display: none;
position: absolute;
top: 0%;
left: 0%;
width: 100%;
height: 100%;
background-color: black;
z-index:1001;
-moz-opacity: 0.8; /*改变图片透明度,越小越透明,*/
opacity:.50;
filter: alpha(opacity=88);
}
.white_content {
display: none;
position: absolute;
top: 25%;
left: 25%;
width: 50%;
height:50%;

border: 5px solid #33498b;
background-color: white;
z-index:1002;
overflow: auto;
}
.checkboxset{margin:0 auto; width:60%;}
.checkb1{float:left; margin:22% 25px;}
.checkb2{ float:left;margin:22% 25px;}
.checkb3{float:left;margin:22% 25px;}
.checkb4{float:left;margin:22% 25px;}
</style>

<script type="text/javascript">
//弹窗设置
function clK(){
document.getElementById('light').style.display='block';
document.getElementById('fade').style.display='block';
}

function clickClose(){
document.getElementById('light').style.display='none';
document.getElementById('fade').style.display='none';
}
</script>
</head>
<body>
<div><h3 onclick="clK()">点击弹窗</h3></div>
<div id="light" class="white_content">
<input type="button" id="consoleBtn" value="取消" onclick="clickClose()" />
</div>
<div id="fade" class="black_overlay"></div>
</body>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: