發(fā)表日期:2015-12-10 文章編輯:南昌開(kāi)優(yōu)網(wǎng)絡(luò) 瀏覽次數(shù):4345 標(biāo)簽:CSS應(yīng)用
<!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代碼-開(kāi)優(yōu)網(wǎng)絡(luò)</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的背景透明在網(wǎng)頁(yè)中應(yīng)用比較廣泛,但瀏覽器的兼容問(wèn)題一直很讓人頭疼,這個(gè)<a target="_blank">JS焦點(diǎn)圖代碼</a>,是用JS判斷的方法,西西用CSS變通的也實(shí)現(xiàn)了PNG背景透明的兼容問(wèn)題。</p> <p>說(shuō)明:</p> <p>1、當(dāng)CSS中出現(xiàn)兩個(gè)同樣的屬性,無(wú)論是否有!important,IE6只識(shí)別最后一個(gè)屬性。(IE6是識(shí)別!important的,后面的background-image起干擾作用,呵呵~)</p> <p>2、在Firefox下,!important被優(yōu)先執(zhí)行,F(xiàn)ILTER濾鏡不起作用。</p> </body> </html>