Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using an <hr> tag with a table?

Tags:

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?

like image 395
user979150 Avatar asked Dec 15 '11 15:12

user979150


People also ask

Can you put a HR in a table?

You can't put anything that isn't a table row inside a table's body.

How do I add a horizontal line to a table in HTML?

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.

How is HR tag used?

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.

Should HR tag be used?

The <hr> tag is an empty tag, and it does not require an end tag. Used to specify the alignment of the horizontal rule.


1 Answers

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; } 
like image 197
Undefined Avatar answered Sep 20 '22 11:09

Undefined