【发布时间】:2020-03-23 22:04:09
【问题描述】:
我正在尝试调整第一个单元格的大小。我正在尝试使用 max-widh,并将样式放在 HTML 和宽度中,但我无法调整该单元格的大小。 是带有粘性行和列的表格
这是 de css 代码。
div {
max-width: 40em;
max-height: 30em;
overflow: scroll;
position: relative;
}
table {
position: relative;
border-collapse: collapse;
}
td,
th {
padding: 0.30em;
}
thead th {
position: -webkit-sticky; /* for Safari */
position: sticky;
top: 0;
color: #000;
}
thead th:first-child {
left: 0;
z-index: 1;
}
tbody th {
position: -webkit-sticky; /* for Safari */
position: sticky;
left: 0;
background: #FFF;
border-right: 1px solid #CCC;
}
<div>
<table>
<thead>
<tr>
<th>head </th>
<th>head</th>
<th>head</th>
</tr>
</thead>
<tbody>
<tr>
<th>Closer2Nature Shopify UK</th>
<td>body</td>
<td>body</td>
</tr>
</tbody>
</table>
</div>
【问题讨论】:
-
能否也分享一下HTML代码
-
当然,伙计。
-
你得到了答案还是还在寻找?