home Designing Webpages
Ka-Neng Au
HOME
INTRODUCTION
LAYOUT
FORMAT
LINKS
LISTS
TABLES
BACKGROUNDS
IMAGES
NAVIGATION

TABLES

Several tags are necessary for a Table; cells are defined by rows first and then columns. <table> = starts a table </table> <tr> = table row </tr> <th> = table header </th> <td> = table data element (or cell) </td> The <table> tag can be modified in many ways. Three common attributes of this tag are border, cellpadding (for extra space around each cell), and cellspacing (for extra space between each cell). The <th> and <td> tags can also be modified a couple of ways, including setting the column width and backgcolor. To center a table on the page, use <center> before and </center> after the table.

Exercise:

<center> <h2>My Webpage</h2> </center> <h3>My Friends</h3> <table border="1" cellpadding="10"> <tr><th width="200">First name</th> <th width="200">Last name</th> <th>Telephone</th></tr> <tr><td>John</td> <td>Smith</td> <td>732-555-1212</td></tr> <tr><td>Jane</td> <td>Brown</td> <td>973-555-1212</td></tr> </table> <h3>My Friends</h3> <center> <table border="1" cellspacing="10"> <tr><th>First name</th> <th>Last name</th> <th>Telephone</th></tr> <tr><td>John</td> <td>Smith</td> <td>732-555-1212</td></tr> <tr><td>Jane</td> <td>Brown</td> <td bgcolor="yellow">973-555-1212</td></tr> </table> </center>
This page was last updated 24 March 2004.