定位绝对表 safari / iOS

问题描述 投票:0回答:1

我有以下代码,在 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>

html css safari
1个回答
0
投票

这样的东西不应该在桌子上使用。表格行或组不提供定位或包含。

tr {
    position: relative;
}
span {
    position: absolute;
    inset: 0;
}

https://codepen.io/dutchcelt/pen/GReoMWG

© www.soinside.com 2019 - 2024. All rights reserved.