Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is <tr> tag optional?

<table>
  <td>cell1</td>
  <td>cell2</td>
</table>

I found out that this tags work on ie8, firefox 11 and chrome, but not sure whether this is valid by standards and work on all major browsers.

like image 558
alice Avatar asked Jun 17 '12 04:06

alice


People also ask

Does TR tag need to be closed?

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

What is the purpose of the TR tag?

The <tr> tag is used to define a row in an HTML table.

Is TR empty tag?

It's legal for a <tr> element to contain no <td> elements or only empty ones. This indicates an empty row in the table.


2 Answers

All browsers accept "quirks" in HTML layout and will render a "best guess" based on what they find. But in the HTML specifications, a <tr> tag is DEFINITELY required — regardless of whether it works or not, you should always use valid HTML!

Check early, check often!

http://validator.w3.org/

like image 64
MBHNYC Avatar answered Sep 17 '22 23:09

MBHNYC


<tr> tag is of course required with <table>, it specifies the begining and ending of the particular row, so it can't be neglected.

like image 23
Bhavesh G Avatar answered Sep 18 '22 23:09

Bhavesh G