table-tag
These are the tags needed to build a table.
<table> surrounds all of the table. It can include the attribute border, showing whether the table should have a visible border, and the width of it.
<tr> means table row.
<td> surrounds a single field in a table. With the attributes colspan and rowspan you can control, whether the field should be merged with the fields on the right and below.
A simple example follows:
<table border="1"><tr><td> Field 1 </td><td rowspan="2"> Field 2 </td></tr><tr><td> Field 3 </td></tr><tr><td colspan="2"> This is a table. </td></tr></table>In the example above I have made many line breaks to separate my tags from my content. It works fine, if the only content is text, but if the table also has pictures, the line breaks will become visible, and you might not want that.
It's hard to make the code for tables easily readable. But as always it's important to decide, and then use the same method every time. Here's another version.
<table border="1"> <tr> <td>Field 1</td> <td rowspan="2">Field 2</td> </tr> <tr> <td>Field 3</td> </tr> <tr> <td colspan="2">This is a table.</td> </tr> </table>
Concept last updated: 17/11 2003.
Relations
|
Other sources
- Beginning XHTML; Frank Boumphrey, CG, DR, JR, SS, TW - 6 Tables
- Diverse opgaver - Struktur
- Diverse XHTML eksempler - Tabeller
- The Web Wizard's Guide to Dreamweaver; James G. Lengel - Chapter 2, Working with text, Text tables