Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get a solid line between each row in a table?

Tags:

html

css

Html is not my specialty :)

I have an Html table and I want to have a solid line between each row. I've done it by defining a border-bottom on each <td> tag, like so:

<td style="border-bottom: 1px solid #0066ff;">[content]</td>

But it comes out with a one-pixel gap in the line, as seen below:

enter image description here

I tried putting the border-bottom in the <tr> tag, but that didn't work at all. What's the correct way to do this?

like image 457
Shaul Behr Avatar asked Feb 03 '26 16:02

Shaul Behr


1 Answers

You may use the CSS attribute border-collapse and set it to collapse:

table
{
  border-collapse: collapse;
}

td
{
  border-bottom: solid 1px black;
}
<table>
  <tr>
    <td>Test</td>
    <td>Test 2</td>
    </tr>
  <tr>
    <td>Test</td>
    <td>Test 2</td>
    </tr>
</table>
like image 131
jcaron Avatar answered Feb 05 '26 06:02

jcaron