I have table with few rows. I want 1st and 3rd row height to be set to 1 px and the 2nd row to normal height. But my code is not working.
HTML CODE goes below
<table border="0">
<tr style="height:2px;" >
<td width="10"><hr></td>
</tr>
<tr style="height:20px;" >
<td width="10">Hello</td>
</tr>
<tr style="height:20px;" >
<td width="10"><hr></td>
</tr>
</table>
Could anyone please tell me how to do it ?
Note: I dont want borders to be used because i Want for certain rows i may or may not need the horizontal line inside the rows.
The height of rows 'tr' in a table can be fixed very easily. This can be done by adding the height attribute in the tr tag. If the height is not specified, the height of the row changes according to the content. The height can be specified either in pixels, or percentage.
Change row height To set the row height to a specific measurement, click a cell in the row that you want to resize. On the Layout tab, in the Cell Size group, click in the Table Row Height box, and then specify the height you want. To use the ruler, select a cell in the table, and then drag the markers on the ruler.
To set the cell width and height, use the CSS style. The height and width attribute of the <td> cell isn't supported in HTML5. Use the CSS property width and height to set the width and height of the cell respectively.
To manipulate the height or width of an entire table, place the size attribute (either "WIDTH=" or "HEIGHT=") within the <TABLE> code. To manipulate individual cells, place the size attribute within the code for that cell.
Add style="padding:0px; margin:0px;"
to your hr
and change the height
of your third tr
to 2px
You will have :
<table border="0">
<tr style="height:2px;" >
<td width="10px"><hr style="padding:0px; margin:0px;"></td>
</tr>
<tr style="height:20px;" >
<td width="10px">Hello</td>
</tr>
<tr style="height:2px;" >
<td width="10px"><hr style="padding:0px; margin:0px;"></td>
</tr>
</table>
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