News GoLive Help and Tutorials HTML Help and Tutorials JavaScript Help and Tutorials Links, Files, and Resources Contact and Contribution Info
 
   
HTML Tutorial
HTML Basics : Tables

Tables

Okay, here's a couple of standard tables:

Stuff More stuff Added things
Ranting Raving Arguing
More things Bits Pieces

Stuff More stuff Added things
Ranting Arguing
Bits

You immediately notice something: you only see the pretty 'bevelled boxes' if you've put something in them; in table 2, three cells are empty, so you just see blank space. Just remember that when you're designing.

Okay, the HTML for a table (the first example above) is as follows: NOTE: DO NOT COPY AND PASTE this code!!! If you do, you'll get strange results because there are invisible characters and so on here that aren't important for you to know. To get some table-code to copy and paste, click here.

<TABLE BORDER="4" CELLPADDING="0" CELLSPACING="2" WIDTH="200">

<TR>
<TD>Stuff</TD>
<TD>More stuff</TD>
<TD>Added things</TD>
</TR>

<TR>
<TD>Ranting</TD>
<TD>Raving</TD>
<TD>Arguing</TD>
</TR>

<TR>
<TD>More things</TD>
<TD>Bits</TD>
<TD>Pieces</TD>
</TR>
</TABLE>

Okay, let's explain the tags now:

The <TABLE> and </TABLE> tags obviously mark the beginning and end of the table code. Duh.

The <TR> and </TR> tags mark the beginning and end of each *ROW* of the table. Think "TR" = "Table Row".

The <TD> and </TD> tags mark the beginning and end of each *CELL* of the table.

It's important to see that your HTML for the table works from left-to-right along the top row of the table, then left-to-right along the next row, and so on.

NOTE: Each cell's contents are left-aligned by default. To center the text in, for example, the first cell:

<TD><CENTER>Stuff</CENTER></TD>

You now need to know what all that BORDER="4" CELLPADDING="0" CELLSPACING="2" WIDTH="200" stuff inside the <TABLE> tag means.

BORDER sets the thickness of the table's border. Note that a value of 0 makes the table invisible; this is good for flowing text into columns invisibly. Here are a few examples of one-cell tables with different BORDERs:

BORDER=4 (Default)

BORDER=3

BORDER=2

BORDER=1

BORDER=0

CELLPADDING sets the amount of space between the edges of a cell and the cell's contents. Examples:

CELLPADDING=0 (Default)

CELLPADDING=1

CELLPADDING=2

CELLPADDING=3

CELLPADDING=4

CELLSPACING sets the amount of space between adjacent cells; i.e. the thickness of the 'dividing lines' between cells. Here are some two-cell tables as examples:

CELLSPACING=1
CELLSPACING=1

CELLSPACING=0
CELLSPACING=0

CELLSPACING=2 (Default)
CELLSPACING=2 (Default)

CELLSPACING=3
CELLSPACING=3

CELLSPACING=4
CELLSPACING=4

WIDTH obviously sets the width of the whole table, in pixels. No examples needed for that one. ;-)

That's it, really. I think that's enough to get you started with tables. Below is some table-code to copy and paste, for your convenience.

HTML Table-code to copy and paste











































































    <TABLE BORDER="4" CELLPADDING="0" CELLSPACING="2" WIDTH="200"> <TR> <TD></TD> <TD></TD> <TD></TD> </TR> <TR> <TD></TD> <TD></TD> <TD></TD> </TR> <TR> <TD></TD> <TD></TD> <TD></TD> </TR> </TABLE>
Back to HTML Basics
  
These tutorials were contributed by Matt Ridley. If you have any questions, corrections, or suggestions on how to improve it, you may email him at mattman@mattman.net. Visit his own site at http://www.mattman.net.

Matt currently works for the GoLive Technical Support Center, and regularly shares his knowledge with users of the GoLive Talk List.

Sources: Personal experience.


Back to HTML Tutorials

Design and Content ©1999 WebDawn Multimedia. View our Copyright Notice.
Send Comments and Feedback to the WebMaster.