纯CSS弹出框不论页面大小绝对居中适合所有浏览器
2011-11-22 14:16
537 查看
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>弹出框绝对居中</title>
<style>
.pop_box{height:200px; width:200px; background-color:#f4eee8; text-align:center;position:fixed; top:50%; left:50%; margin-top:-100px; margin-left:-100px; _position:absolute; /* for IE6 */ _top: expression(documentElement.scrollTop + (documentElement.clientHeight-this.offsetHeight)/2); /* for IE6 */ overflow:visible; z-index:11;}
.bg{background-color: #000;width: 100%;height: 100%;left: 0;top: 0; /*FF IE7*/filter: alpha(opacity = 70) !important; /*IE*/ opacity: 0.50; /*FF*/z-index: 10;position: fixed !important; /*FF IE7*/position: absolute; /*IE6*/ _height:1120px;}
</style>
</head>
<body>
<div class="pop_box"></div>
<div class="bg"></div>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>弹出框绝对居中</title>
<style>
.pop_box{height:200px; width:200px; background-color:#f4eee8; text-align:center;position:fixed; top:50%; left:50%; margin-top:-100px; margin-left:-100px; _position:absolute; /* for IE6 */ _top: expression(documentElement.scrollTop + (documentElement.clientHeight-this.offsetHeight)/2); /* for IE6 */ overflow:visible; z-index:11;}
.bg{background-color: #000;width: 100%;height: 100%;left: 0;top: 0; /*FF IE7*/filter: alpha(opacity = 70) !important; /*IE*/ opacity: 0.50; /*FF*/z-index: 10;position: fixed !important; /*FF IE7*/position: absolute; /*IE6*/ _height:1120px;}
</style>
</head>
<body>
<div class="pop_box"></div>
<div class="bg"></div>
</body>
</html>
相关文章推荐
- 让页面绝对居中,且可以随便改变页面布局兼容所有现代浏览器的方法
- 页面弹出新窗口,新开浏览器,控制大小,屏幕居中,隐藏浏览器工具栏
- css超简单实现div页面居中【适合做弹出框】
- CSS+DIV一行三列(等宽高,有间距)怎么写?(适合所有浏览器)
- css实现弹出框在页面居中
- 弹出页面脚本,自动根据页面大小居中
- JS 打印界面的CSS居中代码适用所有浏览器
- 【SCRIPT脚本控制页面不随ctrl+鼠标滚轮而缩放】+【CSS控制页面文字大小不随浏览器设置而改变】
- 纯js实现Div在页面垂直居中!可根据浏览器大小的改变而改变!兼容各种浏览器----神器版!
- j2ee的web项目,在浏览器中发起一个该项目中html页面的绝对地址,也是发起的一个http url请求,请求的响应报文的结果就是该html页面的所有html代码
- css超简单实现div页面居中【适合做弹出框】
- CSSJS弹出层效果,兼容所有浏览器
- 弹出层水平垂直居中(支持浏览器窗口大小改变,存在垂直滚动条)
- css 背景透明 适合所有浏览器
- javascript 弹出层始终居中兼容所有浏览器(浏览器缩小自动居中)
- css如何使body背景图片适合所有大小宽度的屏幕
- JS 打印界面 CSS居中试用所有浏览器
- css超简单实现div页面居中【适合做弹出框】
- CSS控制所有浏览器水平居中和控制链接不换行的效果
- JS 打印界面的CSS居中代码适用所有浏览器