解决PNG图片在IE6中背景不透明方法_解决IE6中PNG背
解决PNG图片在IE6中背景不透明方法_解决IE6中PNG背
1、解决PNG图片在IE6中背景不透明的CSS与JS代码 - TOP
JS代码
| function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6. { var arVersion = navigator.appVersion.split("MSIE") var version = parseFloat(arVersion[1]) if ((version >= 5.5) && (document.body.filters)) { for(var j=0; j<document.images.length; j++) { var img = document.images[j] var imgName = img.src.toUpperCase() if (imgName.substring(imgName.length-3, imgName.length) == "PNG") { var imgID = (img.id) ? "id='" + img.id + "' " : "" var imgClass = (img.className) ? "class='" + img.className + "' " : "" var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' " var imgStyle = "display:inline-block;" + img.style.cssText if (img.align == "left") imgStyle = "float:left;" + imgStyle if (img.align == "right") imgStyle = "float:right;" + imgStyle if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle var strNewHTML = "<span " + imgID + imgClass + imgTitle + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" img.outerHTML = strNewHTML j = j-1 } } } } window.attachEvent("onload", correctPNG); |
| #id{background:url(图 片路径) ;_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true', sizingMethod='scale', src="图片路径");_background:none;} |
2、解决png图片在html中IMG标签使用PNG图片IE6中背景不透明方法 - TOP
1、新建一个JS文件为iepngfx.js,进以上JS代码拷贝到JS文件里
2、在HTML中声明只有IE6读取此新建JS文件iepngfx.js中
只允许IE6读取此JS文件方法:
<!--[if IE 6]>
<script src="data:images/iepngfx.js" language="javascript" type="text/javascript"></script>
<![endif]-->
3、在html中使用图片标签IMG运用PNG图片,在IE6试试看PNG图片背景是否透明了。
3、在CSS中png作为网页背景时在IE6中背景透明方法 - TOP
同样方法
1、新建JS文件同上,命名为iepngfx.js,进以上JS代码拷贝到JS文件里
2、在HTML中声明只有IE6读取此新建JS文件iepngfx.js中
只允许IE6读取此JS文件方法:
<!--[if IE 6]>
<script src="data:images/iepngfx.js" language="javascript" type="text/javascript"></script>
<![endif]-->
3、在CSS中运用PNG图片作为背景的地方加入以下CSS代码:
| #id{background:url(图 片路径) ;_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true', sizingMethod='scale', src="图片路径");_background:none;} |
这样即可解决PNG图片在HTML中img作为图片图标背景不能透明或PNG图片作为网页背景background运用的一样实现PNG图片背景透明。
以下JS和CSS方法解决PNG图片在IE6中背景不透明方法对你有用。
解决PNG图片在IE6中背景不透明方法_解决IE6中PNG背的更多相关文章
- shell中&&和||的使用方法_转
shell中&&和||的使用方法 &&运算符: command1 && command2 &&左边的命令(命令1)返回真(即返 ...
- Java中获取路径的方法_自我分析
就目前的我来说最常用的两种获取路径的方法是 class.getRecource(filename) 和 class.getclassloader.getRecource(filename) 这两者的 ...
- 对象内存空间 在创建对象后 运行时 会把对象的方法放到jvm的方法区中 调用时 将方法拿到栈中 执行完后 这个方法会出栈 然后新的方法方法进栈
- QTime中currentTime()的使用方法
QTime中currentTime()的使用方法 QTime是Qt中一个处理时间的类,其成员函数currentTime()是最经常用到函数,下面举例说明该成员函数如何使用. 1. 包含头文件 #inc ...
- Qt中静态变量使用方法
静态变量可以在各个页面之前使用 先定义一个用于存放静态变量的类 例如datavar 在datavar.h中添加如下代码 #ifndef DATAVAR_H #define DATAVAR_H #inc ...
- iOS7中UIView的animateKeyframesWithDuration方法讲解
iOS7中UIView的animateKeyframesWithDuration方法讲解 在iOS7中,给UIView添加了一个方法用来直接使用关键帧动画而不用借助CoreAnimation来实现,那 ...
- schema中的虚拟属性方法
schema中的虚拟属性方法相当于vue中的计算属性,它是通过已定义的schema属性的计算\组合\拼接得到的新的值 var personSchema = new Schema({ name: { f ...
- java中static变量和方法的总结
转自:http://blog.csdn.net/haobo920/article/details/5921621 java中static变量和方法的总结 java中一切皆是对象 一个类中对象的定义一般 ...
- JavaScript中this的使用方法总结
JavaScript中this的使用方法总结 在JavaScript中,this的使用分为四种场景,具体请参考阮一峰老师关于this的讲解 第一种情况是纯函数使用 var x =1 ; functio ...
随机推荐
- ZBrush中Document特性介绍
ZBrush®中的Document调色板用于加载或保存ZBrush文档,导入背景图像.导出背景图像.调整画布大小和设置背景颜色.本文小编来给大家介绍下Document常用的一些基本功能. ZBrush ...
- input上传文件获取文件后缀名+select通过text选中option
1.input获取后缀名 var fileName = $("input[type='file']").val();//获取上传的文件(单个) var extName = file ...
- 二、frps 完整配置文件
# [common] is integral section [common] # A literal address or host name for IPv6 must be enclosed # ...
- Vue基础知识点
基础知识: vue的生命周期: beforeCreate/created.beforeMount/mounted.beforeUpdate/updated.beforeDestory/destorye ...
- 【HDU 6299】Balanced Sequence
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 我们贪心地把每一个括号序列能匹配都按照栈的规则都匹配出来. (直接递增匹配对数*2就可以了 最后栈里面就只剩下类似))))((((( ...
- 洛谷 1063 dp 区间dp
洛谷 1063 dp 区间dp 感觉做完这道提高组T1的题之后,受到了深深的碾压,,最近各种不在状态.. 初看这道题,不难发现它具有区间可并性,即(i, j)的最大值可以由(i, k) 与 (k+1, ...
- Eureka Server添加用户认证
Eureka Server添加用户认证 学习了:http://blog.csdn.net/liuchuanhong1/article/details/54729556 注意:1,需要使用 defaul ...
- 非典型的scala程序及其编译后的结果
初学Scala Folder structure以及部分代码 watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY2xldmVyd3lx/font/5a6L5L ...
- poj3249 Test for job 【图的DAG dp】
#include <cstdio> #include <cstdlib> #include <iostream> #include <algorithm> ...
- C/C++易错难点笔记01
疑惑点 C++是一门奇妙的语言.非常多时候你对底层不熟悉,非常难知道某些情况下的结果,以下是我不断积累的疑惑点,这里将其记录下来. 类的转换问题 代码: class A{ public: virtua ...