a标签加绝对定位在图片上面,a的链接和块状属性block失效,而且是所有IE版本都失效的

谷歌和火狐浏览器下测试是正常的,IE下鼠标移过logo是没有超链接的提示的

<!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; 270px; height:129px; margin:50px auto;}
.logo img{ display:block; border:none;}
.logo a{ position: absolute;left: 30px;top: 35px; 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; 200px;height: 60px;display: block; background:url(blank);}

原文地址:https://www.cnblogs.com/csdttnk/p/3258678.html