首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

简单的lightbox里的z-index有关问题

2012-09-01 
简单的lightbox里的z-index问题?JScript code!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional

简单的lightbox里的z-index问题?

JScript code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html>    <head>        <title> New Document </title>        <meta name="Generator" content="EditPlus">    <meta name="Author" content="">    <meta name="Keywords" content="">    <meta name="Description" content="">        <style type="text/css">        .black_overlay{            display:none;            position:absolute;            top:0%;            left:0%;            width:100%;            height:100%;            background-color:black;            z-index:1001;            opacity:0.70;            }        .white_content{            display:none;            top:30%;            left:30%;            width:40%;            height:40%;            padding:16px;            border:16px solid orange;            background-color:white;            z-index:1002;            overflow:auto;        }    </style>    </head>    <body>        <h3>lightbox演示</h3>        <p>观看效果<a href="JavaScript:void(0)" onclick="document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'; "> 请单击这里 </a></p>                        <div id="light" class="white_content">这里是lightbox的弹出内容<a  href="JavaScript:void(0)"onclick="document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'; ">关闭</a>        </div>        <div id="fade" class="black_overlay"></div>    </body></html>
。。。。。应该是z-index的问题。。。。。。1002>1001啊。。可是在chrome里。。。黑色那1001层盖住了提示框的1002那层。。。。why?初学者谢谢您啦。。。

[解决办法]
z-index如果元素的position不是绝对定位(absolute),默认是0,你再设成几万也没用,建议修改下css

热点排行