
I want to individually color in cells on a 2x5 row html table, pictured in the above image.
I can't find any examples of :nth-child allowing you to individually select and set the color of multiple different table cells like how I want to. I'm only familiar with very basic html & css so I'm not sure what I'd do here to accomplish this.
what I have written in the html file :
<!DOCTYPE html>
<html>
<head>
<style>
table, td {border: 1px solid black; border-collapse: collapse;}
td {height: 50px; width: 100px; text-align: center; padding: 0px;}
th {height: 30px; width: 100px; text-align: center;}
tr:nth-child(2) {background-color: #fff000;}
</style>
</head>
<body>
<table>
<th>name</th>
<tr>
<td>1<br>a</td>
<td>2<br>b</td>
</tr>
<tr>
<td>3<br>c</td>
<td>4<br>d</td>
</tr>
<tr>
<td>5<br>e</td>
<td>6<br>f</td>
</tr>
<tr>
<td>7<br>g</td>
<td>8<br>h</td>
</tr>
<tr>
<td>9<br>i</td>
<td>10<br>j</td>
</tr>
</table>
</body>
</html>
I also want the tablehead to be centered between both vertical rows and can't figure that out either