I need to ensure that the red headers do not overlap with the blue headers' borders while scrolling horizontally. It is essential for me to have a white border on the blue headers.
.container {
overflow: auto;
width: 200px;
}
table {
border-collapse: collapse;
}
th {
background-color: red;
border-right: 1px solid white;
color: white;
padding: 10px;
z-index: 1;
}
.sticky {
background-color: blue;
position: sticky;
z-index: 2;
}
.test1 {
left: 0;
}
.test2 {
left: 57px;
}
.test3 {
left: 114px;
}
<div class="container">
<table>
<thead>
<tr>
<th class="sticky test1">
Test1
</th>
<th class="sticky test2">
Test2
</th>
<th class="sticky test3">
Test3
</th>
<th>
Test4
</th>
<th>
Test5
</th>
<th>
Test6
</th>
</tr>
</thead>
</table>
</div>
I need help in ensuring that the red headers do not intrude into the border of the blue headers when scrolling horizontally. The presentation of having a white border around the blue headers is crucial for me.