我有一段代码在IE6中按照我的意愿执行,但在Chrome / Firefox中没有:
在IE6中,img以相对于td的绝对位置显示,正如我想要/期望的那样。在Firefix / Chrome中,img相对于外部div显示。
<div>
<table>
<tr>
<td class="rel cell">
<img src="style/easypos_mobile/icons/pencil.png" class="icon" onclick="_onclick.newArticle_andraNr();"/>
</td>
</tr>
</table>
</div>
.rel
{
position: relative;
}
.icon
{
position: absolute;
top: 3px;
right: -23px;
}
.cell
{
width: 186px;
}
答案 0 :(得分:1)
发现这个东西:
规格让它开放 User-Agent决定是否有表格单元格 可以充当绝对的容器 定位的物体。 http://www.w3.org/TR/CSS21/visuren.html#propdef-position (注意'的影响 '位置:亲戚' table-row-group,table-header-group, 桌脚组,桌排, table-column-group,table-column, table-cell和table-caption元素 未定义')。
这解决了它:
<table><tr>
<td style="position: relative; width: 180px;">
<div style="position:relative;width:100%;height:100%;">
<img src="imageA.gif" class="status">
<img src="imageB.gif" class="status">
</div>
</td>
</tr></table>