Imperial Club HTML tutorial, tables

Imperial Home Page -> Standards -> HTML tutorial, tables

Tags and attributes:
<table> create a table
<tr> create a row
<th> create a heading cell
<td> create a standard cell
<caption> creates a caption above the table

A table contains one or more rows. A row contains one or more heading or standard cells. You can intermix standard and heading cells in one row.
borderSets the borderwidth (table only)
bordercolor=sets the color of the border

vertically aligns the text in a cell   top   center      bottom  
align=horizontally aligns the text in a cellleftcenterright
cellspacing=sets the number of pixels between each cell (table only)
cellpadding=amount of space between edge of the cell and the text in the cell (table only)
bgcolor=set the background color of the table/row/cell
colspan=stretches the cell to span multiple columns (cell only)This cell spans 3 columns
rowspan=stretches the cell to span multiple rows (cell only)this cell spans 2 rows  
background=sets the background to be the specified image
width=the width of the table/cell, either as a % of the screen/table or as a number of pixels. width="100%" makes the table fit on the screen

Width should only appear in the first row for seting the width of the columns

Tables cells can contain all tags, including tables

tables are rendered differently in Netscape and IE. Borders behave differently in IE and Netscape. Bordercolor only changes the color on the outside border of the table, IE changes the color of all the borders, in IE this can be a cell by cell attribute, for Netscape it only works on the whole table. Plan on checking with both browsers (including multiple versions if available, and on multiple OSes if possible).

Continue on to Section 6 FTP basics

This page was last updated 24 May, 2005.  Send us your feedback, and join the Imperial Mailing List online car club today!