Hi!
Is this definition of a html table valid xhtml?
<table>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
In short, is it legal to have more TDs in one TR than in another?
Thanks
| SitePoint Sponsor |


Hi!
Is this definition of a html table valid xhtml?
<table>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
In short, is it legal to have more TDs in one TR than in another?
Thanks

No. You have to have an equal number of columns in each row. Otherwise it isn't valid in any version of HTML. You will need to use 'colspan' to make one table cell stretch to the width of two table cells to be valid.
John Conde | Facebook | Twitter
Brainyminds Merchant Account Services I Love Code eBook Giant
Authorize.Net: AIM API | ARB API | CIM API Get the FREE code!
Merchant Accounts 101 | Ecommerce 101


Actually, you can, but you should normally use colspan to specify that one cell should span more than one column.
If you want an empty (unused) cell in one row, just add an empty cell (<td></td>).
The example you posted is legal; the omitted cell in the second row will be implied, but it seems unsemantic. There should either be a column span or an explicit empty cell, IMHO.
Birnam wood is come to Dunsinane

colspan and rowspan -- they're both great. Start here, but please, ignore the improper unclosed tr and td tags - bad form!


Off Topic:
It's not improper; that's valid HTML the way it used to be written back then. But I agree that it's bad form nowadays.
Birnam wood is come to Dunsinane
I can't find such conformance requirements in any version of HTML. Could you give me a pointer?Originally Posted by stymiee
Simon Pieters
Bookmarks