绝对定位在IE中不起作用



这段代码在chrome和Firefox中完美运行,但在IE中,绝对定位的div出现在右上角。

<div id="three_pictures">
   <img alt="3steps" src="/assets/3steps.jpg">
   <a href="/users/new" style="position: absolute; top: 65px; left: 50px; width: 204px; height: 256px;"></a>
   <a href="/get_a_present" style="position: absolute; top: 16px; left: 273px; width: 191px; height: 303px;"></a>   
   <a href="/posted_presents" style="position: absolute; top: 51px; left: 508px; width: 148px; height: 276px;"></a> 
</div>

#three_pictures
{
padding-top: 20px;
width: 700px;
position: relative;
background-color: white;
margin: 0px auto;
}

我想在图像的某些区域有链接。

#three_pictures 的包含元素是什么,它的样式如何(如果有的话)?

如果没有,那么看起来您的margin: 0px auto;实际上并没有处理 #three_pictures 元素(因为它的样式position:relative;),所以您需要做的是将其包装在一个单独的div 中,该div 上有margin: 0px auto; and width:700px;样式。

首先你更改 id 名称,然后你必须使用此样式代码为其

#stepsThree{
   position:relative;
}

我认为对于它,此致敬意

这正是他们发明图像映射的目的。它们仍然有效,并且在 HTML 5 中受支持。

最新更新