为什么做了logo,用png格式的,在dz变成灰底儿了呢?
答::
因为IE6一下的版本是不支持PNG格式的图片的,想要在IE6实现透明图片,需要另外想办法
1.有个简单的办法,用PS把图片转换成GIF格式,但是这样做的后果是,图片锯齿很严重。
2.另外就是需要JS代码来实现了,我给你一段代码,放到HEAD里面就行了 PNG图片透明代码: - <script>
- function correctPNG()
- {
- for(var i=0; i<document.images.length; i++)
- {
- var img = document.images[i]
- 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='image');"></span>"
- img.outerHTML = strNewHTML
- i = i-1
- }
- }
- }
- window.attachEvent("onload", correctPNG);
- </script>
复制代码
|