IE6不支援透明的PNG圖片,有灰白底色,ie6不支援png底色
解決方案:
1. 濾鏡
IE瀏覽器中特有的濾鏡效果,且必須將png檔案作為背景映像.
Filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,src=string,sizingMethod)是否啟用濾鏡效果.背景映像的顯示方式
Image:放大或縮小盒子尺寸,以顯示整個背景映像.
Crop:裁切圖片以適應對象尺寸.
Scale:縮放圖片以適應對象尺寸.
#box{ // 針對IE
Width:152px;
Height:152px;
Filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=”PNG映像的URL” ,sizingMethod=image)
}
Html>body #box{ // 針對非IE
Background:url(images/circle.png);
}
1. JS+透明gif
引用外部的JS檔案,(只針對文檔中的圖片png ,對背景無效)
<script type=”text/javascript” src=””></script>
2. DD_belatedPNG
前兩個不支援background-position,background-repeat
<!--[if IE6]>
<script type=”text/javascript”src=”js/DD_belatedPNG_0.0.8a-min.js”>
</script>
<script>
DD_belatedPNG.fix(‘css選取器,應用類型’);
</script>
<!--[endif]-->
例如:fix(‘#box,img’) , fix(‘#box,background’).
在使用方式情節一為背景映像添加連結時,在IE6中,背景映像的非空白地區不能觸發連結,解決方案:為連結添加position:relative;屬性.