0

我在网页中有一个表格,有时有空单元格。当在我的笔记本电脑上的 Firefox 浏览器上查看时,它会绘制这些单元格的边框,即使它们是空的。当我在我的 iPad3 Safari 浏览器上查看它时,它没有。

我发现了我认为可能是解决方案的 CSS empty-cells:show,尽管文档确实建议这show是默认设置。我想也许 iPad 浏览器可能有不同的默认设置,所以我尝试了一下,但没有任何区别。

iPad3上的Safari浏览器是否关注CSS empty-cells:show?我还应该做些什么来让我的空单元格周围有边框吗?在这种情况下,我无法访问 html,因此我无法将 a 添加 到空单元格中以使其非空,因此我需要 CSS 解决方案(或确认没有 CSS 解决方案)。

table {
    empty-cells: show;
}
td {
    border-bottom:  1px blue inset;
    border-left:    1px blue inset;
    border-spacing: 1px 1px;
}
    <html>
    <head>
    </head>
    <body>
      <table>
        <tr>
          <td>test data</td>
          <td>more data</td>
          <td></td>
          <td>after the empty cell</td>
        </tr>
        <tr>
          <td>test data</td>
          <td>more data</td>
          <td>and more</td>
          <td>after the empty cell</td>
        </tr>
      </table>
    </body>
    </html>

4

1 回答 1

0

将以下属性添加到您的表中。边框折叠:折叠;这将为所有单元格绘制边框,即使它们是空的。也应该在 Safari 上工作。

table {
    empty-cells: show;
    border-collapse: collapse;
}
td {
    border-bottom:  1px blue inset;
    border-left:    1px blue inset;
   border-spacing: 1px 1px;
}
于 2016-08-12T16:47:11.750 回答