You should close your <TR>
and <TD>
tags if possible, but NOT ALWAYS because in some scenarios it may disturb you. This is because the <TR>
and <TD>
tags could be styled to display:none
while the </TR>
tag couldn't. It means that a scenario in which you want to extend / limit your display with media queries, will fail if you use </TR>
. Consider the following code:
<style>
@media (max-width : 480px) {
.hidden-class {display:none;}
}
</style>
<table>
<tr>
<td>cell 1</td>
</tr class="hidden-class"> <!-- this will fail! -->
<tr class="hidden-class">
<td>cell 2</td>
</tr> <!-- this could stay -->
</table>
It means that you would write it as:
<table>
<tr>
<td>cell 1</td>
</tr> <!-- this will now close the TR for every screen width, which will destroy your extenstion -->
<tr class="hidden-class">
<td>cell 2</td>
</tr> <!-- this could stay -->
</table>
Which means that the only way to do so is by OMITTING THE in the first place:
<table>
<tr>
<td>cell 1</td>
<tr class="hidden-class">
<td>cell 2</td>
</tr> <!-- this could stay -->
</table>
chrome\n
is the contents of your table cell. Depending on CSS this will cause visual layout differences compared to if the<td>
was closed immediately after the word "chrome". – Abhi Beckert Oct 1 '14 at 23:53