a标签加绝对定位在图片上面,a的链接和块状属性block失效,而且是所有IE版本都失效的
2013-08-14 23:08
357 查看
谷歌和火狐浏览器下测试是正常的,IE下鼠标移过logo是没有超链接的提示的
修复ie下的bug:
方法一:给a标签加一个透明的背景图片,然后再给背景设置透明;缺点影响效率;
方法二:给a标签加一个无效的背景图片链接,缺点多了一个http请求;.logo a{ position: absolute;left: 30px;top: 35px;width: 200px;height: 60px;display: block; background:url(blank);}
<!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=utf-8" /> <title>无标题文档</title> <style type="text/css"> *{ padding:0; margin:0;} .logo{ position:relative; width:270px; height:129px; margin:50px auto;} .logo img{ display:block; border:none;} .logo a{ position: absolute;left: 30px;top: 35px;width: 200px;height: 60px;display: block;} </style> </head> <body> <div class="logo"> <img src="http://www.baidu.com/img/bdlogo.gif" alt="" /> <a title="其实我是360搜索" href="http://www.so.com"></a> </div> </body> </html>
修复ie下的bug:
方法一:给a标签加一个透明的背景图片,然后再给背景设置透明;缺点影响效率;
方法二:给a标签加一个无效的背景图片链接,缺点多了一个http请求;.logo a{ position: absolute;left: 30px;top: 35px;width: 200px;height: 60px;display: block; background:url(blank);}
相关文章推荐
- 把文字链接 绝对定位到图片上面
- IE下超链接使用绝对定位后失效
- 把文字链接 绝对定位到图片上面
- IE下超链接使用绝对定位后失效原因分析及解决方法
- <img>标签链接地址失效如何自动显示默认图片
- 在Win server2003 中 右键IE属性 “无法定位序数325于动态链接库SHDOCVW.dll”
- 关于在IE中a标签设置绝对定位和宽高之后却点击没有反应的解决方案
- 关于IE中超链接绝对定位无法识别点击区域
- a标签的下载链接,如果是图片,点击链接是下载一个图片而不是直接打开,应该怎么办?(添加download属性)
- IE中a标签绝对定位设置高宽却无法点击的问题
- 关于 IE6 中绝对定位(position:absolute)中的left和bottom属性失效
- A标签绝对定位后IE下不可点击问题
- html基础-图片标签、表格的属性、链接的属性及链接的分类、name定义锚点的名称、网页的自动刷新、基本字符
- IE中超链接绝对定位无法识别点击区域
- <a>标签内嵌<input type="image">在IE中链接失效问题
- 关于IE中超链接绝对定位无法识别点击区域
- [开发技巧]用div挡住flash,给flash加上链接(兼容ie+firefox,具备a链接所有属性)
- 实现div的背景图片在各个浏览器上自适应显示:即backgroun-size属性不支持低版本ie的解决方案
- 关于IE中显示PNG背景透明图片以及链接失效的总结
- IE下当a标签使用position:absolute绝对定位时没有点击区域的bug