div背景半透明ie6

上传人:豆浆 文档编号:788608 上传时间:2017-05-14 格式:DOCX 页数:3 大小:17.76KB
返回 下载 相关 举报
div背景半透明ie6_第1页
第1页 / 共3页
div背景半透明ie6_第2页
第2页 / 共3页
div背景半透明ie6_第3页
第3页 / 共3页
亲,该文档总共3页,全部预览完了,如果喜欢就下载吧!
资源描述

《div背景半透明ie6》由会员分享,可在线阅读,更多相关《div背景半透明ie6(3页珍藏版)》请在金锄头文库上搜索。

1、div 背景半透明,覆盖整个可视区域的遮罩层效果背景半透明,覆盖整个可视区域的遮罩层效果在工作中经常会遇到,这篇文章主要介绍了当内容超过一屏时如何做到多浏览器的兼容性。 下面我们通过一个简单的例子看看如何实现,高手请绕道。html 代码很简单 1 、半透明效果可以使用 css3 中的 opacity 属性,在低版本的 IE 浏览器中使用 IE 的 alpha 滤镜。代码:.opacity opacity:0.3;filter: alpha(opacity=30); background-color:#000; 2 、要覆盖整个可视区域通常的做法是:html,body height:100% .

2、maskheight:100%;width:100%;但是这样做当内容超过一屏时只有 IE6 下显示的效果是我们所期望的,在其他浏览器中首屏以下的没能被遮盖住,为了兼容其他浏览器我们可以使用position:fixed; 来解决这个问题.完整的代码:html,body height:100%; margin:0; padding:0.maskheight:100%; width:100%; position:fixed; _position:absolute; top:0; z-index:1000; .opacity opacity:0.3; filter: alpha(opacity=30

3、); background-color:#000; 一个实际的代码例子:view sourceprint?背景半透明覆盖整个可视区域html,body height:100%; margin:0; padding:0; font-size:14px;p line-height:18px;.maskheight:100%; width:100%; position:fixed; _position:absolute; top:0; z-index:1000; .opacity opacity:0.3; filter: alpha(opacity=30); background-color:#00

4、0; .contentheight:600px; width:800px; overflow:auto; border:2px solid #ccc; background-color:#fff; position:absolute; top:50%; left:50%; margin:-300px auto auto -400px; z-index:1001; word-wrap: break-word; padding:3px; .ph height:1000px;place holder height:1000px;背景半透明覆盖整个可视区域这个效果效果在工作中经常会遇到,这篇文章主要介

5、绍了当内容超过一屏时如何做到多浏览器的兼容性。 下面我们通过一个简单的例子看看如何实现,高手请绕道。 html 代码很简单 1 、半透明效果可以使用 css3 中的 opacity 属性,在低版本的 IE 浏览器中使用 IE 的 alpha 滤镜。代码: .opacity opacity:0.3; filter: alpha(opacity=30); background-color:#000; 2 、要覆盖整个可视区域通常的做法是: html,body height:100% .maskheight:100%;width:100%; 但是这样做当内容超过一屏时只有 IE6 下显示的效果是我们

6、所期望的,在其他浏览器中首屏以下的没能被遮盖住,为了兼容其他浏览器我们可以使用position:fixed; 来解决这个问题 完整的代码:html,body height:100%; margin:0; padding:0.maskheight:100%; width:100%; position:fixed; _position:absolute; top:0; z-index:1000; .opacity opacity:0.3; filter: alpha(opacity=30); background-color:#000; 参考资料:背景半透明最佳实践垂直居中的几种实现方法DIV 高度 100%

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 行业资料 > 其它行业文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号