标签:
JS代码:
<!--[if IE 6]>
<script src="~/Scripts/UI/DD_belatedPNG.js"></script>
<script>
$(function () {
//1、通过公共类
DD_belatedPNG.fix(".pngFix,.pngFix:hover");
//2、直接用选择器:类名,ID,标签
DD_belatedPNG.fix(".imgpng,img");
});
</script>
<![endif]-->
html代码:
<div class="contain">
<h1>DD_belatedPNG实现IE6下的透明背景</h1>
<div class="con">
<h2>1、通过公共类pngFix</h2>
<p>
window.onload = function () {
DD_belatedPNG.fix(".pngFix,.pngFix:hover");
}
</p>
<img src="../../Content/IMG/IE6.png" class="pngFix" />
<div class="imgpng pngFix"></div>
</div>
<div class="con">
<h2>2、直接用选择器:类名,ID,标签实现</h2>
<p>
DD_belatedPNG.fix(".imgpng,img");
</p>
<img src="../../Content/IMG/IE6.png" />
<div class="imgpng"></div>
</div>
</div>
css代码:
<style>
.contain { width: 1000px; height: 300px; margin: 0 auto; background: #fff; }
.contain .con { width: 400px; float: left; }
.contain h1 { font-size: 18px; color: #333; margin-bottom: 10px; }
.contain h2 { font-size: 16px; color: #333; }
.imgpng { width: 200px; height: 150px; background: url(/Content/IMG/Ie6.png); }
</style>
标签:
原文地址:http://www.cnblogs.com/dazhangli/p/4742487.html