最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
png透明图片在ie6正常显示的纯css解决办法
时间:2012-08-13 编辑:简简单单 来源:一聚教程网
方法一:用png图作背景
要注意hack
html代码
代码如下 | 复制代码 |
css代码
代码如下 | 复制代码 |
.logo { width: 338px; height: 57px; float: left; background: url(/images/logo.png) 0px 0px no-repeat!important; text-indent: -1000px; _background-image: none; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/logo.png', senabled='true', sizingMethod='scale'); } |
方法二:插入png图片,定义img
这个方法要准备一完全透明的图片transparent.gif,大小随意。
html代码
代码如下 | 复制代码 |
css代码 .logo { width: 338px; height: 57px; float: left; } .logo img { width: 338px; height: 57px; } /* png 透明 兼容 ie6 */ .logo img { azimuth: expression( this.pngSet ? this.pngSet = true:(this.nodeName == "IMG" && this.src.toLowerCase().indexOf('.png')>-1 ? (this.runtimeStyle.backgroundImage = "none", this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "', sizingMethod='image')", this.src = "/images/transparent.gif"):(this.origBg = this.origBg? this.origBg :this.currentStyle.backgroundImage.toString().replace('url("','').replace('")',''), this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.origBg + "', sizingMethod='crop')", this.runtimeStyle.backgroundImage = "none")),this.pngSet=true ); } |
相关文章
- 纯css实现鼠标经过图片上时,图片突出显示特效 05-06
- CSS样式控制图片裁切显示 01-26
- CSS 鼠标点击拖拽效果代码展示 10-31
- CSS使用SVG实现动态分布的圆环发散路径动画教程 10-31
- css3中仿放大镜效果的几种方式原理介绍 10-26
- CSS3切割轮播图的代码展示 10-26