Is it safe to omit </TD> and </TR> tags?

user479870 picture user479870 · Oct 26, 2010 · Viewed 10.8k times · Source

According to w3c </TD> and </TR> tags are optional, so the following table is perfectly valid.

<table>
  <tr>
    <td>google
    <td>chrome
</table>

And all browsers I've tested it with render the table fine. I just wanted to ask if this is generally considered safe to use, or if older browsers, which I don't have access to, cause problems. Thanks.

It reduces gzip html size on a page with many tables by a few percent.

Answer

SLaks picture SLaks · Oct 26, 2010

This is valid HTML but invalid XHTML.
There's nothing intrinsically wrong with it.

If you look at the source for Google's privacy policy (or any of their other pages), you'll find some much terser HTML.

It does mean that your page will not be usable by an XML parser.