Producing web pages
* HTML CSS DHTML XHTML A to Z of tags        Design    Internet

Using tables

Tables are very, very useful. You'll see them used on web sites for two major purposes:

  • The obvious purpose of arranging information in a table: to display rows and columns of text or numerical data
  • The less obvious - but more widely used - purpose of controlling a page layout

Here are some of the ways you can use tables:

  • To arrange text and graphics. You can create columns, hanging indents and extra white space
  • To give structure to a page. You might create a narrow column for a table of contents and a wider column to hold the content of a page

Think of a table as a grid; the table itself is the outside boundary of the grid, and the grid is made up of rows and columns.

Here's an example of a basic table:

<table>
<tr><td>A basic table</td>
</tr>
</table>

All tables involve using the below three tags:

<table></table>

All tables begin and end with the <table> and </table> tags. All the information appears between these tags.

<tr></tr>

Add a row. A table must have at least one row

<td></td>

Add a column within a row.

All tables must also have a least one column. The column can contain text, pictures, links or even another table

You can now go ahead and create a basic table.