I am looking to extend the border-top of each <tr>
element within an HTML table by 1rem on both sides seamlessly.
body {
padding: 4rem;
}
table {
border-collapse: collapse;
}
tr {
border-top: 1px solid #000;
}
tr:before {
content: '';
display: block;
width: 2rem;
border-top: 1px solid black;
}
tr:after {
content: '';
display: block;
width: 2rem;
border-top: 1px solid black;
}
td {
padding-top: 1rem;
padding-bottom: 1rem;
}
<table>
<tr><td>Hello</td><td>Goodbye</td></tr>
<tr><td>Hello</td><td>Goodbye</td></tr>
<tr><td>Hello</td><td>Goodbye</td></tr>
</table>
The border is displaying with a height of 2px rather than 1px. How can I adjust this so that the border seamlessly extends on both sides?