半透明遮罩层覆盖整个可视区域

我们经常会遇到点击一个按钮弹出一个对话框和一个变暗的遮罩层,简单的写法只能让遮罩层覆盖浏览器的大小,那么怎么让遮罩层覆盖全部区域呢?

css代码如下:

 1 html,body {
 2     height: 100%;
 3     margin: 0;
 4     padding: 0;
 5 }
 6 .mask {
 7     height: 100%;
 8     width: 100%;
 9     position: fixed;
10     _position: absolute;
11     top: 0;
12     z-index: 100;
13 }
14 .opacity {
15     opacity: 0.3;
16     filter: alpha(opacity=30);
17     background: #000;
18 }

 

posted @ 2013-06-26 13:50  Misaki Yui  阅读(1380)  评论(0编辑  收藏  举报