Why do we need to use br tag in tables as mentioned in the topic "tables"?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why do we need to use br tag in tables as mentioned in the topic "tables"??

4th Oct 2019, 2:30 PM
Mayank
Mayank - avatar
3 Answers
+ 3
HTML automatically settles the heights of the rows by the highest elements in the rows. If you only left blanks in each column of a row you would cause the row to be displayed as "closed" or as mimum height. Like this: ______ |__|__| |__|__| Would be displayed like this: |==|==| |==|==| Because the columns were empty in each row they automatically got the smallest row height. You can increase the smallest height to the height of gap created by newline <br />, which can be of the same height as a paragraph with 1 line of text.
4th Oct 2019, 4:26 PM
Seb TheS
Seb TheS - avatar
+ 3
Is this the code you are wondering about? <table border="2"> <tr> <td>Red</td> <td>Blue</td> <td>Green</td> </tr> <tr> <td><br /></td> <td colspan="2"><br /></td> </tr> </table> In that example, <br /> is used simply so that the columns can be visible. Try to remove the <br /> from the code and you will understand. Empty table columns <td></td> will not be visible as obvious because there's nothing there to show. You can alternatively use &nbsp; in place of the <br />. You can also use <br /> to write column text in multiple lines, as follows: <td>This<br />text<br />is broken</td>
4th Oct 2019, 4:34 PM
Ipang
0
Yeah I too noticed that ๐Ÿ˜€๐Ÿ˜€thanks man๐Ÿ‘๐Ÿ‘
4th Oct 2019, 4:28 PM
Mayank
Mayank - avatar