markzzz markzzz - 1 year ago 65
HTML Question

<div> into a <tr>: is it correct?

Is this code correct?

<table>
<tr>
<td>...</td>
</tr>

<tr>
<div>...</div>
</tr>

<tr>
<td>...</td>
</tr>
</table>


don't know for semantic (and W3C rules). What can you say about?

Answer Source

No it is not valid. tr elements can only contain th and td elements. From the HTML4 specification:

<!ELEMENT TR       - O (TH|TD)+        -- table row -->
<!ATTLIST TR                           -- table row --
  %attrs;                              -- %coreattrs, %i18n, %events --
  %cellhalign;                         -- horizontal alignment in cells --
  %cellvalign;                         -- vertical alignment in cells --
>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download