咨询电话:186 7916 6165 咨询电话:186 7916 6165 (微信同号)    在线QQ:181796286
NEWS BLOG ·
学无止境
关注开优网络 关注前沿
CSS的防止图片撑破页面的代码(图片自动缩放)
网站变灰代码

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

发表日期:2015-12-10    文章编辑:南昌开优网络    浏览次数:4362    标签:CSS应用

<!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> 
</body> 
</html>