I am facing an issue where the border of my table is being cut off when using overflow: hidden. Below is an example code snippet illustrating this problem.
<style>
table {
border-collapse: collapse;
}
table {
border: 1px solid black;
overflow: hidden;
}
</style>
<body>
<table>
<thead>
<tr>
<th>header 1</th>
<th>header 2</th>
<th>header 3</th>
</tr>
</thead>
<tbody>
<tr>
<th>side header</th>
<td>data 1</td>
<td>data 2</td>
</tr>
</tbody>
<tfoot>
<tr>
<th>footer header</th>
<td>footer 2</td>
<td>footer 3</td>
</tr>
</tfoot>
</table>
</body>
</html>
I have stripped down my example to just the essentials. Removing the border-collapse style fixes the issue, but I need that style for my code structure. This hacky workaround in the CSS below seems to work temporarily, but I'm not a fan of using hacks!
.borderhack:after {
content: '\00a0';
position: absolute;
border: 1px solid black;
left: -2px;
top: -2px;
width: 100%;
height: 100%;
z-index: -10;
}
table {
position: relative;
}
I would greatly appreciate any explanations or alternative solutions to this problem. After spending a considerable amount of time investigating, I am eager to understand why this is happening.
Thank you