background:url("images/search_inpbg.png")
no-repeat
0
0*background:
none
transparent
scroll
repeat
0%
0%
FILTER:
progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/search_inpbg.png',
sizingMethod='scale')
滤镜里面的图片是相对于你页面的路径。而不是样式的路径
。。。。你可以去看下我的
http://www.ok22.org
指向视频
会显示播放效果..你可以把我的样式下载下来看下。加粗是你应该理解的地方。其实滤镜的图片要刚刚跟你控制的DIV大小一样才行。。(除非你用的是一个的没有过渡效果透明PNG)这样才不会变形
第一种方法,把图片做成GIF的图片,也可以透明,第二种方法:用JS实现让图片透明。
var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])
function fixPNG(myImage)
{
if ((version >= 5.5) &&(version <7) &&(document.body.filters))
{
var imgID = (myImage.id) ? "id='" + myImage.id + "' " : ""
var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : ""
var imgTitle = (myImage.title) ?
"title='" + myImage.title + "' " : "title='" + myImage.alt + "' "
var imgStyle = "display:inline-block" + myImage.style.cssText
var strNewHTML = "<span " + imgID + imgClass + imgTitle
+ " style=\"" + "width:" + myImage.width
+ "pxheight:" + myImage.height
+ "px" + imgStyle + ""
+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
+ "(src=\'" + myImage.src + "\', sizingMethod='scale')\"></span>"
myImage.outerHTML = strNewHTML
}
}
使用方法 :
在<HEAD>段里加上
<script language="JavaScript" type="text/javascript" src="pngfix.js"></script>
[注意你的路径]
在要透明的png 的地方格式为:
<img src="xyz.png" alt="foo" width="10" height="20" onload="fixPNG(this)">
注意, 你的图片的高与宽是不能去掉的! 就是多了 onload="fixpng(this)" 而已.
这个需要用到JS 首先,打开Dreamweaver,新建一个JavaScript基本页,并复制以下代码替换掉里面的代码,完成后保存为png.js文件// Correctly handle PNG transparency in Win IE 5.5 or higher.function correctPNG()
{
for(var i=0i<document.images.lengthi++)
{
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 + "pxheight:" + img.height + "px" + imgStyle + ""
+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
+ "(src=\'" + img.src + "\', sizingMethod='scale')\"></span>"
img.outerHTML = strNewHTML
i = i-1
}
}
}
window.attachEvent("onload", correctPNG)然后打开你要使PNG透明的页面,在<head>区内插入下面代码,注意一下地址就可以了<script type="text/javascript" src="png.js"></script>