css div实现的遮罩层完美兼容IE6-IE9 FireFox
(编辑:jimmy 日期: 2024/11/17 浏览:3 次 )
Html代码:
复制代码代码如下:
<div id="black_overlay" style="display: none;"></div>
<div style="display: none;" id="load_content" >
<div style="float: left; padding-top: 12px; padding-left: 5px;">
<img src="/UploadFiles/2021-03-30/progressBar.gif"></div>
<div style="float: left; padding-top: 15px;">数据加载中,请稍后...</div>
</div>
CSS样式:
复制代码代码如下:
/*loading加载遮罩层css*/
#black_overlay
{
position: fixed;
z-index: 1000;
width: 100%;
height: 100%;
top: 0;
left: 0;
filter: alpha(opacity=80);
opacity: 0.8;
overflow: hidden;
background-color: #000;
}
*html
{
background: url(*) fixed;
}
*html body
{
margin: 0;
height: 100%;
}
/*IE6*/
*html #black_overlay
{
position: absolute;
left: expression(documentElement.scrollLeft + documentElement.clientWidth - this.offsetWidth);
top: expression(documentElement.scrollTop + documentElement.clientHeight - this.offsetHeight);
}
#load_content
{
display: none;
position: absolute;
top: 40%;
left: 40%;
width: 200px;
height: 50px;
border: 16px solid #FFF;
border-bottom: none;
background-color: white;
z-index: 1002;
overflow: auto;
font-size: 14px;
font-weight: bold;
}
效果图:
IE6:
其他版本效果:就不一一贴图了。
复制代码代码如下:
<div id="black_overlay" style="display: none;"></div>
<div style="display: none;" id="load_content" >
<div style="float: left; padding-top: 12px; padding-left: 5px;">
<img src="/UploadFiles/2021-03-30/progressBar.gif"></div>
<div style="float: left; padding-top: 15px;">数据加载中,请稍后...</div>
</div>
CSS样式:
复制代码代码如下:
/*loading加载遮罩层css*/
#black_overlay
{
position: fixed;
z-index: 1000;
width: 100%;
height: 100%;
top: 0;
left: 0;
filter: alpha(opacity=80);
opacity: 0.8;
overflow: hidden;
background-color: #000;
}
*html
{
background: url(*) fixed;
}
*html body
{
margin: 0;
height: 100%;
}
/*IE6*/
*html #black_overlay
{
position: absolute;
left: expression(documentElement.scrollLeft + documentElement.clientWidth - this.offsetWidth);
top: expression(documentElement.scrollTop + documentElement.clientHeight - this.offsetHeight);
}
#load_content
{
display: none;
position: absolute;
top: 40%;
left: 40%;
width: 200px;
height: 50px;
border: 16px solid #FFF;
border-bottom: none;
background-color: white;
z-index: 1002;
overflow: auto;
font-size: 14px;
font-weight: bold;
}
效果图:
IE6:
其他版本效果:就不一一贴图了。
下一篇:CSS写的简单表格示例