日期:2014-05-17  浏览次数:20745 次

CSS图片映射,IE和FF不兼容问题
代码:
<!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=gb2312 "   />
<title> 无标题文档 </title>
<style   type= "text/css ">
#pic{
width:400px;
height:300px;
position:relative;
}
#pic   ul{
margin:0px;
height:0px;
list-style-type:none;
}
#pic   a{
position:absolute;
color:#000;
display:block;
text-decoration:none;
width:100px;
height:100px;
border:1px   solid   #00ff00;
}
#pic   a:hover{
border:1px   solid   #ff0000;
}
#pic   .one   a{
top:15px;
left:20px;
}
#pic   .two   a{
top:86px;
left:182px;
}
#pic   .three   a{
top:208px;
left:237px;
}
</style>
<script   type= "text/javascript ">
</script>
</head>
<body>
<div   id= "pic ">
<img   src= "test.jpg "   width= "400 "   height= "300 "   border= "0 "   />
<ul>
<li   class= "one "> <a   href= "# "> 第一个热点 </a> </li>
<li   class= "two "> <a   href= "# "> 第二个热点 </a> </li>
<li   class= "three "> <a   href= "# "> 第三个热点 </a> </li>
</ul>
</div>
</body>
</html>

注:
测试时请注意图片地址
问题:
链接块的空处(无文字处)在IE6.0中为什么点击无效,怎么解决?
FF中正常

------解决方案--------------------
给a加个背景
#pic a{
background:#fff;
position:absolute;
color:#000;
display:block;
text-decoration:none;
width:100px;
height:100px;
border:1px solid #00ff00;
}

------解决方案--------------------
方法可以如楼上所说!
------解决方案--------------------
改变下zIndex值就可以了。。
storm0(飘零雾雨.闻弦歌而知雅意,顾叶落而晓秋至)
code修改如下。。

<!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=gb2312 " />
<title> 无标题文档 </title>
<style type= "text/css ">
#pic{
width:400px;
height:300px;
}
#pic img {
border:none;
width:400px;
height:300px;
position:absolute;
z-index:1;
}
#pic ul {
margin:0;
height:0;
list-style:none;
position:absolute;
z-index:2;
}
#pic a {
position:absolute;
text-decoration:none;
width:100px;
height:100px;
border:1px solid #00ff00;
}
#pic a:hover {
border:1px solid #ff0000;
}
#pic .one a {
top:15px;
left:20px;
}
#pic .two a {
top:100px;
left:150px;
}
#pic .three a {