Back to Index Colour Tables Tables II Principles Uploading Resources Onward to the Index



August's HTML Crash Course - Tables

Tables, unfortunately, are a little more complicated than just about everything else we've done so far. Don't worry, that doesn't mean they're hard, it just means they're complicated.

The basic tags that these monsters use are the TABLE tag, with ALIGN, HEIGHT, WIDTH, BORDERCOLORLIGHT BORDERCOLORDARK, BORDER, CELLSPACING, BGCOLOR, AND CELLPADDING attributes; the TR [table row] tag; and the TD [table cell] tag, which has some attributes of its own, which we shall get into later. The most important thing to remember right now is that the tags must be placed in that order. If you don't place them properly, your page will be a big ugly mess, and you don't want that. Or, I hope you don't want that.

To start with, lets lay down the structure of a two-row table, so you can see just how they work.

<TABLE>
<TR>
<TD>
This is the first cell, top left.
</TD>
<TD>
This is the second cell, top right.
</TD>
</TR>
<TR>
<TD>
This is the third cell, bottom left.
</TD>
<TD>
This is the fourth cell, bottom right.
</TD>
</TR>
</TABLE>
This table is a grid of four cells, two in the top row, and two in the bottom. You will notice that I didn't close the TR tag until I was done including two cells into it. If you didn't notice it, do so now. That was because I wanted two cells in the row. If I had wanted three cells, I would have included three cells before closing the TR tag. That isn't really a hard concept, but the code is pretty complicated compared to some of the things we've been doing. If you want, you can add more spaces between the tags just to keep things clear. Remember, HTML doesn't recognize the carriage returns you do in Notepad.

I'll be addressing most of the attributes in a supplementary section, but let me just say this about tables: they can be really, really ugly. This entire tutorial has taken place inside tables, but I made them look pretty decent by changing the colours around and getting rid of some of the default attribute settings. If you think your tables are lookin' kind of ugly, then you can make them invisible [the cool thing about that is that they work even though you don't get to see them] by setting the BORDER attribute to "0" [zero]. The BORDER for the tables on this site is "3".

You can use tables to control the layout of your site, make pictures move even more accurately to where you want them to go, and so on, and so on, and so on. Like just about all aspects of HTML, the more versatile the element the more coplex its code. More about tables....

Back to Colour     Onward to Tables II

c: august@vestige.org h: http://www.vestige.org