5,006
社区成员
发帖
与我相关
我的任务
分享
<div style="width:200px; height:200px; position:absolute; background-color:silver;">
<table style="position:absolute; width:100px; height:100px; top:100px; left:100px; background-color:green;">
<tr>
<td>
<div style="position:absolute; width:50px; height:50px; top:50px; left:50px; background-color: gold;">
TEXT
</div>
</td>
</tr>
</table>
</div>
本来是要想让金色的绝对定位 DIV 相对于 TABLE 来定位,但事与愿违,在 Firefox 里,变成了这样:
<div style="width:200px; height:200px; position:absolute; background-color:silver;">
<div style="display:table;position:absolute; width:100px; height:100px; top:100px; left:100px; background-color:green;">
<div style="display:table-row">
<div style="display:table-cell;background:red;">
<div style="position:absolute; width:50px; top:0px; left:0px; height:50px; background-color: gold;">
TEXT
</div>
</div>
</div>
</div>
</div>
<div style="width:200px; height:200px; position:absolute; background-color:silver;">
<table style="display:block; position:absolute; width:100px; height:100px; top:100px; left:100px; background-color:green; border: 0px" cellpadding="0" cellspacing="0">
<tr>
<td style="position:absolute; padding: 0px;">
<div style="position:absolute; width:50px; height:50px; top:50px; left:50px; background-color: gold;">
TEXT
</div>
</td>
</tr>
</table>
</div>