惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Hugging Face - Blog
Hugging Face - Blog
Jina AI
Jina AI
宝玉的分享
宝玉的分享
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
人人都是产品经理
人人都是产品经理
博客园 - 聂微东
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
J
Java Code Geeks
博客园 - 【当耐特】
小众软件
小众软件
博客园 - Franky
S
SegmentFault 最新的问题
WordPress大学
WordPress大学
雷峰网
雷峰网
The Cloudflare Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
量子位
Last Week in AI
Last Week in AI
博客园_首页
月光博客
月光博客
IT之家
IT之家
阮一峰的网络日志
阮一峰的网络日志
Webroot Blog
Webroot Blog
Stack Overflow Blog
Stack Overflow Blog
腾讯CDC
云风的 BLOG
云风的 BLOG
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
W
WeLiveSecurity
Recent Commits to openclaw:main
Recent Commits to openclaw:main
D
Docker
The Last Watchdog
The Last Watchdog
有赞技术团队
有赞技术团队
Hacker News - Newest:
Hacker News - Newest: "LLM"
D
DataBreaches.Net
S
Security @ Cisco Blogs
Blog — PlanetScale
Blog — PlanetScale
GbyAI
GbyAI
TaoSecurity Blog
TaoSecurity Blog
S
Security Affairs
Y
Y Combinator Blog
O
OpenAI News
罗磊的独立博客
MongoDB | Blog
MongoDB | Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Forbes - Security
Forbes - Security
P
Palo Alto Networks Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
K
Kaspersky official blog
Cloudbric
Cloudbric

博客园 - singleblue

IIS7 asp.net配置默认文档的错误 画图工具 UI层方案征集 B/S项目架构探讨 如何做自动录入数据功能 Failed to execute request because the App-Domain could not be created 拼接字符串的效率(转载) 最近准备用的数据访问类,欢迎拍砖! 关于JSON的文章 求助:如何合并两个PDF文档 取水晶报表的总页数 javascript操作cookie javascript全角半角问题 以支持多种浏览器的方式创建XMLHttpRequest对象 四种引用 使用AjaxPro与Session交互时遇到一个问题 window.print() 急求datastage 控件隐藏(Visible=false)的一个问题
解决ie7以下浏览器PNG图片背景不透明且链接失效的办法
singleblue · 2009-03-13 · via 博客园 - singleblue

图片透明处理

<!--[if lt IE 7]>
 <style type="text/css">
 div, img { behavior: url(iepngfix.htc) }
 </style>
<![endif]-->
<style>
body { background:url(/bg.jpg)}
.iepng { width:275px; height:94px; background:url(/home.png); padding:20px; }
</style>
<body>
<div class="iepng">Test<br />
  <br />
<a href="#">图片透明</a></div>
</body>
看到了吧,在IE6下测试一下你会发现,PNG的背景已经是透明的了。但是有些时候我们需要在定位的层上实现这样的效果,如本例的效果我想把它固定在其它层之上,类似于弹出窗口的样子,那么就要用position:absolute;把这个层浮动起来。这时问题又出现了,链接居然失效了???

<!--[if lt IE 7]>
 <style type="text/css">
 div, img { behavior: url(iepngfix.htc) }
 </style>
<![endif]-->
<style>
body { background:url(/bg.jpg)}
.iepng { position:absolute; top:261px; left:309px; width:275px; height:94px; background:url(/home.png); padding:20px; }
</style>

<body>
<div class="iepng">Test<br />
  <br />
<a href="#">Test Text</a></div>
</body>

之前也看到别人提供的方法,说把为链接定义个相对属性position:relative;,但本人试了好像不行。那么有没有其它方法能实现了,下面本人提供一个比较笨的方法来实现:
既然是绝对位置的浮动层,那么我们采用两个绝对位置的浮动层,把背景单独设置在一个层上,并且让这个层居下,在上边的层上放文字及链接内容,这种方法可行吗??实践是检验真理的唯一标准,让我们拭目以待!!

<!--[if lt IE 7]>
 <style type="text/css">
 div, img { behavior: url(iepngfix.htc) }
 </style>
<![endif]-->
<style>
body { background:url(/bg.jpg)}
.iepng { position:absolute; top:261px; left:309px; width:315px; height:134px; background:url(/home.png); z-index:1; }
.iepng1 { position:absolute; top:261px; left:309px; width:275px; height:94px; padding:20px; z-index:2; }
</style>

<body>
<div class="iepng1">TEst<br />
  <br />
<a href="#">Test Text</a></div>
<div class="iepng"></div>
</body>
哈哈,问题居然解决了!采用background:url(/home.png) !important; background:none;filterrogidXImageTransform.Microsoft.AlphaImageLoader(enabled="true", sizingMethod="image", src="/home.png")这种方式让背景透明的,当采用position:absolute;定位时也可以采用双层重叠的方式解决链接失效的问题

出处 http://www.aa25.cn/368.shtml