【发布时间】:2018-08-05 18:59:48
【问题描述】:
https://dev.meteo.cam/pricing 表格上的单元格在小屏幕上重叠:
当然,这个表格有点特别,因为我改变了样式,使得tbody 可以垂直滚动。
然而,令人困惑的是下面的代码示例使用相同的 CSS 样式:
table.table-complex {
width: 200px;
/*added only for this snippet to simulate small screens*/
}
table.table-complex tbody {
display: block;
max-height: calc(100vh - 100px);
overflow: auto;
}
table.table-complex tbody tr,
table.table-complex thead {
border-bottom: 1px solid #ccc;
display: table;
table-layout: fixed;
white-space: normal;
width: 100%;
}
<table class="table-complex">
<thead>
<tr>
<th>Webcam</th>
<th>Price</th>
</tr>
</thead>
<tbody>
<tr>
<td>FTP upload <small>(up to every 5 min)</small><sup>1</sup></td>
<td><b>free</b></td>
</tr>
<tr>
<td>RapidFire FTP upload: <small>(up to every 5 sec)</small><sup>1</sup></td>
<td><b>USD 0.99</b> <small>/month</small></td>
</tr>
<tr>
<td>Archive <small>(10 years)</small><sup>2</sup></td>
<td><b>USD 1.99</b> <small>/month</small></td>
</tr>
</tbody>
</table>
为什么上面的示例可以工作,但在小屏幕上的 https://dev.meteo.cam/pricing 上却不行?
PS:当我通过 Chrome Inspector 在 https://dev.meteo.cam/pricing 上插入 CSS 时,它也可以工作!
【问题讨论】:
-
它正在工作..没有重叠问题..您是否检查了真实设备或 chrome 响应工具
标签: css html-table whitespace tablelayout