I have a table with borders that are set to "none" in CSS. However, I want to put a horizontal line separating each row on the table. I have tried placing <hr>
tags in between each <td> </td>
tag for a particular row, but it prints a horizontal black line with small white spaces between each column.
Is there any way to print a horizontal line within a table using a different method?
You can't put anything that isn't a table row inside a table's body.
Adding the Horizontal Line using <hr> tag: The Horizontal Rule tag (<hr>) is used for the purpose of inserting horizontal lines in the HTML document in order to separate sections of the document. It is an empty or unpaired tag that means there is no need for the closing tag.
Definition and Usage. The <hr> tag defines a thematic break in an HTML page (e.g. a shift of topic). The <hr> element is most often displayed as a horizontal rule that is used to separate content (or define a change) in an HTML page.
The <hr> tag is an empty tag, and it does not require an end tag. Used to specify the alignment of the horizontal rule.
I'd suggest putting:
<tr style="border-bottom: 1px solid #000;">
on every row you want the line to be on. You can also do this individually for each cell.
Update
Id recommend using a css class and a have a separate stylesheet if you can. For example
<tr class="bordered"></tr> tr.bordered { border-bottom: 1px solid #000; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With