我有以下代码,在 Firefox 上效果很好,但在 Safari 上,忽略
tr
相对位置,并且 td
相对于 .container
而不是 tr
放置
.container {
position: relative;
padding: 100px;
background-color: red;
}
tr {
position: relative;
}
td {
position: absolute;
top: 0;
height: 10px;
width: 10px;
background-color: blue
}
<div class="container" >
<table>
<tr>
<td></td>
</tr>
</table>
</div>
这样的东西不应该在桌子上使用。表格行或组不提供定位或包含。
tr {
position: relative;
}
span {
position: absolute;
inset: 0;
}