Here is my CSS and HTML setup:
.comTable {
width: 95%;
cellpadding: 2px;
margin: auto;
border-collapse: collapse;
}
.comTable td {
text-align: left;
}
.comTable td:first-child {
text-align: right;
width: 25%;
}
<table id="tableMain" class="comTable">
<tr>
<td>
Some texts 1
</td>
<td>
<table id="table2">
<tr>
<td>
Some more texts
</td>
<td>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
Some texts 2
</td>
<td>
<table id="table3">
<tr>
<td>
Some more texts...
</td>
<td>
</td>
</tr>
</table>
</td>
</tr>
</table>
The issue I am facing is that the .comTable CSS class is being applied to table2 and table3, causing their first column to also be set to 25%. How can I ensure that .comTable td:first-child only affects tableMain? Ideally, I would like to avoid applying a class to each first td in tableMain due to the large number of rows it contains.