I'm trying to make a table with first column fixed, and it worked. ( how do I create an HTML table with fixed/frozen left column and scrollable body? )
However, some of styles are not applied to the fixed column even if its parent node does.
For example,
.even {
background-color: #c0c0c0;
}
.fixed-col {
position: absolute;
left: 0;
width: 50px;
}
table {
margin-left: 50px;
}
<div style="position:relative;">
<div style="overflow-x:scroll">
<table>
<tr class="even">
<td class="fixed-col">a</td>
<td>b</td>
<td>c</td>
</tr>
<tr class="odd">
<td class="fixed-col">a</td>
<td>b</td>
<td>c</td>
</tr>
<tr class="even">
<td class="fixed-col">a</td>
<td>b</td>
<td>c</td>
</tr>
</table>
</div>
</div>
I want to make the fixed columns' background color striped as other columns. How can I fixed this?