兼容IE6和Firefox的PNG背景透明CSS代码

本文提供了一种兼容IE6和Firefox的PNG背景透明CSS代码实现方式,通过使用双背景图片声明及IE专有滤镜,确保不同浏览器下的一致显示效果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>兼容IE6和Firefox的PNG背景透明CSS代码</title>
<style type="text/css">
<!--
.lanrentuku {
background-image:url(http://www.lanrentuku.com/down/js/images/12593184560.png)!important;background-image:url(www.lanrentuku.com);
FILTER: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://www.lanrentuku.com/down/js/images/12593184560.png');
WIDTH: 225px;height:38px;}
-->
</style>
</head>


<body>
<div class="lanrentuku"></div>


<p><strong>兼容IE6和Firefox的PNG背景透明CSS代码</strong></p>
<p>PNG的背景透明在网页中应用比较广泛,但浏览器的兼容问题一直很让人头疼,这个<a href="http://www.lanrentuku.com/js/jiaodiantu-710.html" target="_blank">JS焦点图代码</a>,是用JS判断的方法,西西用CSS变通的也实现了PNG背景透明的兼容问题。</p>
<p>说明:</p>
<p>1、当CSS中出现两个同样的属性,无论是否有!important,IE6只识别最后一个属性。(IE6是识别!important的,后面的background-image起干扰作用,呵呵~)</p>
<p>2、在Firefox下,!important被优先执行,FILTER滤镜不起作用。</p>
<p>作者:<a href="http://www.lanrentuku.com" target="_blank">西西</a>(尊重他人劳动成果,转载请自觉注明出处!)</p>
<p>查找更多代码,请访问:<a href="http://www.lanrentuku.com" target="_blank">懒人图库</a></p>
</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值