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

推荐订阅源

博客园 - 叶小钗
云风的 BLOG
云风的 BLOG
G
Google Developers Blog
S
SegmentFault 最新的问题
罗磊的独立博客
Hugging Face - Blog
Hugging Face - Blog
美团技术团队
爱范儿
爱范儿
博客园 - 三生石上(FineUI控件)
H
Hackread – Cybersecurity News, Data Breaches, AI and More
D
DataBreaches.Net
F
Fortinet All Blogs
TaoSecurity Blog
TaoSecurity Blog
D
Docker
C
Cybersecurity and Infrastructure Security Agency CISA
K
Kaspersky official blog
宝玉的分享
宝玉的分享
腾讯CDC
Google Online Security Blog
Google Online Security Blog
Recorded Future
Recorded Future
T
The Exploit Database - CXSecurity.com
T
The Blog of Author Tim Ferriss
V
V2EX
S
Securelist
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
C
CERT Recently Published Vulnerability Notes
A
Arctic Wolf
Scott Helme
Scott Helme
L
LINUX DO - 热门话题
Y
Y Combinator Blog
P
Proofpoint News Feed
T
Tor Project blog
AWS News Blog
AWS News Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
The Last Watchdog
The Last Watchdog
博客园 - 聂微东
T
Threat Research - Cisco Blogs
B
Blog
Attack and Defense Labs
Attack and Defense Labs
L
Lohrmann on Cybersecurity
C
CXSECURITY Database RSS Feed - CXSecurity.com
阮一峰的网络日志
阮一峰的网络日志
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
IT之家
IT之家
N
News and Events Feed by Topic
博客园 - 司徒正美
H
Help Net Security
C
Cisco Blogs
C
Check Point Blog
S
Secure Thoughts

博客园 - 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