The issue arose due to the disparity in height between the column
and the fixed rowhead
.
When using HTML elements with a position-absolut
, only the innerHTML's height is considered.
To address this, I added a min-height
to both your columns
and headers
, along with a min-width
for better styling outcomes. You have the option to modify it within the JSFiddle provided here.
.grades-table {
overflow-x:scroll;
overflow-y:visible;
margin-left: 5em;
}
.grades-header,
.grades-column {
min-width: 150px;
min-height: 38px;
text-align: center;
}
.headcol {
position: absolute;
width: 5em;
min-height: 38px;
left: 0;
top: auto;
border-top-width: 1px;
margin-top: -1px;
background: white;
border-right: 4px solid black;
}
.headcol-text {
position: absolute;
transform: translate(-50%, -50%);
top: 50%;
left: 50%;
}
<div class="grades-table">
<table>
<thead>
<tr>
<th class="headcol">students</th>
<th class="grades-header">01_getting_started</th>
<th class="grades-header">02_courses</th>
<th class="grades-header">03_tasks</th>
<th class="grades-header">04_run_student</th>
<th class="grades-header">05_fetching_input</th>
<th class="grades-header">06_feedback</th>
<th class="grades-header">07_advance_feedback</th>
<th class="grades-header">08_archive</th>
<th class="grades-header">09_ssh_debug</th>
<th class="grades-header">10_environments</th>
</tr>
</thead>
<tbody>
<tr class="grades-row">
<th class="headcol">
<div class="headcol-text">
student1
</div>
</th>
<td class="grades-column"><a href="#">01</a><br><a href="#">X days ago</a></td>
<td class="grades-column"><a href="#">02</a><br><a href="#">X days ago</a></td>
<td class="grades-column"><a href="#">03</a><br><a href="#">X days ago</a></td>
<td class="grades-column"><a href="#">04</a><br><a href="#">X days ago</a></td>
<td class="grades-column"><a href="#">05</a><br><a href="#">X days ago</a></td>
<td class="grades-column"><a href="#">06</a><br><a href="#">X days ago</a></td>
<td class="grades-column"><a href="#">07</a><br><a href="#">X days ago</a></td>
<td class="grades-column"><a href="#">08</a><br><a href="#">X days ago</a></td>
<td class="grades-column"><a href="#">09</a><br><a href="#">X days ago</a></td>
<td class="grades-column"><a href="#">10</a><br><a href="#" href="#">X days ago</a></td>
</tr>
</tbody>
</table>
</div>