I've been attempting to add border-spacing to all rows except the first and last ones using nth-child, but for some reason, it's not having the desired effect. Can anyone point out what mistake I might be making?
table {
border: 1px solid black;
width: 98%;
margin: 0 auto;
border-collapse: separate;
border-spacing: 10px 50px;
}
td {
border: 1px solid black;
}
tr:nth-child(1) td:nth-child(1) {
border-spacing : 0px 0px;
}
tr:nth-child(1) td:nth-child(2) {
border-spacing : 0px 0px;
}
tr:nth-child(3) td:nth-child(1) {
border-spacing : 0px 0px;
}
tr:nth-child(3) td:nth-child(2) {
border-spacing : 0px 0px;
}
<table>
<tr><td> row1 col1 </td><td> row1 col2 </td></tr>
<tr><td> row2 col1 </td><td> row2 col2 </td></tr>
<tr><td> row3 col1 </td><td> row3 col2 </td></tr>
<tr><td> row4 col1 </td><td> row4 col2 </td></tr>
<tr><td> row5 col1 </td><td> row5 col2 </td></tr>
</table>