SitePoint Sponsor |
|
User Tag List
Results 1 to 6 of 6
Hybrid View
-
Sep 29, 2006, 07:25 #1
- Join Date
- Feb 2003
- Location
- eez
- Posts
- 331
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Is this definition of a table legal?
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
-
Sep 29, 2006, 08:25 #2
- Join Date
- Feb 2003
- Location
- Slave I
- Posts
- 23,424
- Mentioned
- 2 Post(s)
- Tagged
- 1 Thread(s)
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.
-
Sep 30, 2006, 03:42 #3
- Join Date
- Dec 2004
- Location
- Sweden
- Posts
- 2,670
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by stymiee
Simon Pieters
-
Sep 29, 2006, 09:16 #4
- Join Date
- Nov 2004
- Location
- Ankh-Morpork
- Posts
- 12,158
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
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
-
Sep 29, 2006, 14:15 #5
- Join Date
- Jan 2004
- Location
- Temecula, CA
- Posts
- 188
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
colspan and rowspan -- they're both great. Start here, but please, ignore the improper unclosed tr and td tags - bad form!
-
Sep 30, 2006, 00:12 #6
- Join Date
- Nov 2004
- Location
- Ankh-Morpork
- Posts
- 12,158
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
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
Bookmarks