Table Samples


This page is to enable fellow users to create tables to spice up your own webpages! Here is a simple table followed by the code that created it.

One Two
Three Four


<TABLE BORDER=1 > - begins the table and specifies border size
<TR> - creates the first horizontal table row
<TD>One</TD> - adds first data cell to the row
<TD>Two</TD> - adds 2nd data cell to row
</TR> - ends the first horizontal table row
<TR> - creates the 2nd horizontal table row
<TD>Three</TD> - adds first data cell to 2nd row
<TD>Four</TD> - adds 2nd data cell 2nd row
</TR> - ends the 2nd horizontal table row
</TABLE>



This table is the same but set for 50% of the width of the screen.
One Two
Three Four


<TABLE BORDER=1 width=50% >


One Two


<TABLE BORDER=5 > - table borders sizes are adjustable by you


One Two
Three Four


<TABLE BORDER=0 > - or can be left out alltogether!


This table is 50% of the page, with left, centre, and right justified contents.
Also the cellspaceing can be set to various widths - this one is set at 10, and the background colour in 2 cells has been changed.
One Two
Three Four


<TABLE BORDER=1 >
<TR>
<TD bgcolor=red>One</TD>
<TD align=right>Two</TD>
</TR>
<TR>
<TD align=right>Three</TD>
<TD bgcolor=red>Four</TD>
</TR>
</TABLE>


This example gives a single-cell table that is a hypertext link(*) which looks like a pushbutton.
GO TO COLOUR CHART


<TABLE BORDER=10 CELLPADDING=5 >
<TR>
<TD><B><A Href='colours.htm'>GO TO COLOUR CHART</A></TD></B></TD>
<TD align=right>Two</TD>
</TR>
</TABLE>

*- HYPERTEXT is simply text that has a piece of HTML code hidden under it that makes it a link to another page anywhere on the web. it is in the form of the <A Href='colours.htm'>GO TO COLOUR CHART</A> code in the above table - this format takes you to a page in the same directory/server, while ...href=http://www.etc is required to head out to another site - anywhere!!! - for example - try doing that to create a link to another site when you create your webpage.


This is a caption!
This has a caption
added to the top
of the table too.

<TABLE BORDER=1 width=50% cellpadding=2 align=center>
<caption align=top>This is a caption!
<TR>


There are also column span (COLSPAN) and Row Span (ROWSPAN) tags used as follows.

One and Two and Three Four
Five Six Seven/Eight
Nine Ten Eleven
Twelve Thirteen Fortynine?

<TABLE BORDER=1 >
<TR>
<TD colspan=3>One and Two and Three</td>
<TD rowspan=2>Four</TD>
</TR>
<TR>
<TD>Five</TD>
<TD>Six</TD>
<TD>Seven/Eight</TD>
</TR>
<TR>
<TD rowspan=2>Nine</TD>
<TD>Ten</TD>
<TD>Eleven</TD>
</TR>
<TR>
<TD>Twelve</TD>
<TD>Thirteen</TD>
<TD>Fortynine?</TD
</TR>
</TABLE>

Note that I can have blank end spots in a row (or a column) by NOT including the <TD> etc in that row.


As you can see, there are all sorts of variations that can be used, and if you do it carefully, you can put different tables inside other tables, you are only limited by your ability to make sure each <TR> & <TD> & <TABLE> is matched by a </TR> & </TD> & </TABLE> respectively - and as long as it is right, any combination can be achieved.

You can also use different coloured fonts(text) in the tables or cells etc, limited only by your own creativity.

Oh yeah, and by the way..... the hard line across the sections above is done using the <HR> command.

Return to Main Info Page

Copyright © 2000 Ian Moggs. All Rights Reserved.
Last updated 20th Mar 2003.