Why is this wrong?
<table>
<form>
<tr><td>something something</td/>
</form>
</table>
I'm talking about position of form tags inside table tags.
From the DTD:
<!ELEMENT TABLE - -
(CAPTION?, (COL*|COLGROUP*), THEAD?, TFOOT?, TBODY+)>
<!ELEMENT CAPTION - - (%inline;)* -- table caption -->
<!ELEMENT THEAD - O (TR)+ -- table header -->
<!ELEMENT TFOOT - O (TR)+ -- table footer -->
<!ELEMENT TBODY O O (TR)+ -- table body -->
<!ELEMENT COLGROUP - O (COL)* -- table column group -->
<!ELEMENT COL - O EMPTY -- table column -->
<!ELEMENT TR - O (TH|TD)+ -- table row -->
<!ELEMENT (TH|TD) - O (%flow;)* -- table header cell, table data cell-->
These are the only elements you can have inside a table
element (in HTML 4 in this case, but you check the same kind of document for other versions, and it's not changed much).
On the other hand, a form
element can contain any other block-level element (except other forms):
<!ELEMENT FORM - - (%block;|SCRIPT)+ -(FORM) -- interactive form -->
And the td
element can contain any "flow" element (as seen in the first code block), and "flow" include block level elements:
<!ENTITY % flow "%block; | %inline;">
So you can put your <form>
tags either around the entire table or inside one table cell.
Only the elements CAPTION, COL, COLGROUP, THEAD, TFOOT and TBODY are allowed as child elements of the TABLE element. See The TABLE element in the HTML specification.
Because you can only put <form>
tags inside <td>
or outside <table>
, according to the standards.