I’m trying to resize the first cell. I’m trying with max-widh, and put the style in the HTML and with width, but I can’t resize that cell.
Is a table with sticky row and col
This is de css code.
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>
This is the HTML code for the table with a sticky col and row.
2
Answers
I don’t understand, why not use only
width
?If I understood correctly this is what you need?