Вот мой код:-< /p>
Код: Выделить всё
.table-wrapper {
max-height: 100px; /* limit height */
max-width: 100%; /* allow horizontal scroll */
overflow: auto; /* enable both scroll directions */
border: 1px solid #333;
}
.table-wrapper table {
border-collapse: collapse;
width: max-content; /* allows left-right scroll */
min-width: 100%; /* prevents shrink */
}
th, td {
border: 1px solid #333;
padding: 8px;
min-width: 80px;
text-align: center;
white-space: nowrap;
}
/* Sticky header */
thead th {
position: sticky;
top: 0;
z-index: 2;
}
/* Sticky first column */
th:first-child,
td:first-child {
position: sticky;
left: 0;
z-index: 3;
}
/* Top-left corner */
thead th:first-child {
z-index: 4; /* higher than header and first column */
}< /code>
Character
Loop 1
Loop 2
Loop 3
Loop 4
Loop 5
Sanders
1
3
5
7
9
Jay2
2
4
6
8
10
Maggie
11
12
13
14
15
Rahul
16
17
18
19
20
Подробнее здесь: https://stackoverflow.com/questions/797 ... p-the-grid