Tutorial!

Although most of Manny's Site deals with a game called GemStone III, less than 40% of my visitors have ever heard of, let alone played, the game. People seem to like Manny's Site for a wide variety of reasons - the stories, the humor, the music, to look at my html code, to get ideas for use on their own web sites, or because they play the game. I recieve compliments about my use of backgrounds with tables, so I created this short tutorial to teach you how to use backgrounds with tables.

To make it easy for you, I've split this into three parts:

Part I : The design intent and parameters of Manny's Site

Part II : The tutorial, complete with sample code, etc.

Part III: Summary


Part I

I included this Part I because I feel that when you set out to create a web site, you should first determine what computing environment your site is to be viewed in. It is my hope that by sharing with you the design parameters I used when I coded Manny's Site you might start thinking about the computing environment required by your own web site.

I set out to create a site that worked with either Netscape or Microsoft IE. To do this:

1) Frames? - Both Netscape and IE support frames. The down side to using frames is it almost forces you to design your web site for a higher resolution (800x600 or 1024x768). If you use frames keep the number of frames as low as possible. I decided not to use frames in the current version of Manny's Site. I considered it  important Manny's Site look clean and uncluttered.

2) Design for a screen resolution of 800 x 600 - Using tables made this easy. I created one table, centered on the page, with a set pixel width (table size=700). The I then added the rest of the page elements within this table. This forced the desired screen resolution of 800 x 600. Viewing at lower resolutions gets you scroll bars, viewing at higher resolutions centers the table(s) on your screen so Manny's Site still looks acceptable. Nice little coding trick no?

3) Use graphics and backgrounds of 64k (16 bit) color depth or more - Here is a tip: To keep control of the way text colors appears on your screen, choose the text colors from the standard 256 (8 bit) color Microsoft Windows pallete. This way your text is always the color you want it to be. That said, I decided that most of the graphics and backgrounds in Manny's Site where to use at least a 64k (16 bit) color depth. Since most computers sold over the past 4-5 years can display a 32k or better color depth - this requires a  video card with 1MB of RAM - this should not be an issue. I personally recommend a 64k (16 bit) color depth for Manny's Site, although 32k color depths work just fine. The look is astonishingly beautiful at 64k (16 bit) color depths (or higher!). Yes, I know this means someone viewing the pages in a 256 (8 bit) color depth mode will not like what they see, but I do not consider asking folks to use at least 32k color depths an unrealistic requirement. The days of a 256 color mode computers are over with as far as I am concerned.

4) Use MIDI music - MIDI music plug-ins are standard fare these days. Both Netscape Communicator and IE 4.0 ship with little java applets to play MIDI music files and there are 3rd party plug-ins (such as Crescendo) you can use as well. Crescendo user take note: There is now an Active-X version of this plug-in!

5) Use Java - Java is also a standard. You personally may not like Java, but that is not the issue here. Basically I purchased a Java marquee applet to use in lieu of Microsoft IE's marquee html tag. Netscape does not support the marquee html tag. Using a Java applet allows me to use a marquee that will work with a wide variety of web browsers and OS's, so thats the way I went. I might purchase, or maybe even try to write, more Java applets in the future. They seem to work well.

6) Keep the loading time on each web page to under 120 seconds with a 14.4 modem - I use a calculator for this. I figure anything under two minutes most folks will tolerate. People like a short load time. Some of the individual files available for downloading may take longer, but the web pages themselves are held to under 120 seconds at 14.4k.

Now lets get on to the toturial!


Part II

Let's get to the heart of the matter. It is possible to write HTML v3.2 code that will:

place a backgound in a page;
place a background in a table;
and place a backgound in a table cell.

So let us have a look at what happens when we try to place a background in a table. Specifically:

1) Table Borders
2) Table Backgrounds
3) An example of 1) and 2) combined

Let's get started!

1) Table Borders - Here is sample code followed by the resulting table:

<table border="0" cellpadding="5" cellspacing="5" width="575">
<tr>
<td align="center"><div align="center"><center><table border="5"
cellpadding="10" cellspacing="10" width="540" background="redcave.jpg">
<tr>
<td align="center"><font size="5">Table/Cell Text</font></td>
</tr>
</table>
</center></div></td>
</tr>
</table>

Table/Cell Text
The Setup:

Page background is a black textured object.
Table background is a red textured object
Cell background is not specified

What you see (with Microsoft IE) :

The table uses the red table background. The table border uses the red table background.

What you see (with Netscape) :

The table uses the red table background. However, the table border pulls its graphic image from the black page background, which can give your web page an entirely different look if you are not careful! The reason for this is given in Part III of this tutorial.

2) Table Backgrounds - Here is sample code followed by the resulting table:

<div align="center"><center>
<table border="0" cellpadding="5" cellspacing="5" width="575">
<tr>
<td align="center"><div align="center"><center><table border="0"
cellpadding="10" cellspacing="10" width="550" background="redcave.jpg">
<tr>
<td align="center"><font size="5">Table/Cell Text</font></td>
<td align="center"><font size="5">Table/Cell Text</font></td>
</tr>
<tr>
<td align="center"><font size="5">Table/Cell Text</font></td>
<td align="center"><font size="5">Table/Cell Text</font></td>
</tr>
<tr>
<td align="center"><font size="5">Table/Cell Text</font></td>
<td align="center"><font size="5">Table/Cell Text</font></td>
</tr>
<tr>
<td align="center"><font size="5">Table/Cell Text</font></td>
<td align="center"><font size="5">Table/Cell Text</font></td>
</tr>
</table>
</center></div></td>
</tr>
</table>
</center></div>

Table/Cell Text Table/Cell Text
Table/Cell Text Table/Cell Text
Table/Cell Text Table/Cell Text
Table/Cell Text Table/Cell Text
The Setup:

Page background is a black textured object.
Table background is a red textured object
Cell background is not specified

What you see (with Microsoft IE) :

The table uses the red table background. There is no table border displayed. Notice the red table background tiles seemlessly over all the cells giving an overall visually pleasing effect.

What you see (with Netscape) :

The table uses the red table background. However, as in the previous example, the table border pulls its graphic image from the black page background. Actually, there should be no border at all! Web page designers take note: Netscape tries to display a border in between the cells using the black page background as its source. Notice that the red textured table background gets loaded into each table cell independently instead of tiling them together seemlessly. The reason for this is given in Part III of this tutorial.

3) A third example - Here is sample code followed by the resulting table:

<div align="center"><center>
<table border="0" cellpadding="5" cellspacing="5" width="575">
<tr>
<td align="center"><div align="center"><center><table border="5"
cellpadding="10" cellspacing="10" width="540" background="redcave.jpg">
<tr>
<td align="center" background="storm.jpg"><font size="5">Table/Cell Text</font></td>
<td align="center" background="glaswirl.jpg"><font size="5">Table/Cell Text</font></td>
</tr>
</table>
</center></div></td>
</tr>
</table>
</center></div>

Table/Cell Text Table/Cell Text
The Setup:

Page background is a black textured object.
Table background is a red textured object
Row 1 column 1 (left most) cell background is grey textured object (sky)
Row 1 column 2 (right most) cell background is blue-green textured object (glass swirls)

What you see (with Microsoft IE) :

The table uses the red table background for the table border. Each cell within the table displays its own texture (background). In effect, this example best demonstates the distinction between page backgrounds, table backgrounds, and cell backgrounds.

What you see (with Netscape) :

Once again, the table border pulls its graphic image from the black page background. The colored, textured cell backgrounds get loaded into each table cell independently. Pay careful attention an you will see that the red table background never shows up! The reason for this is given in Part III of this tutorial.


Part III:

Hopefully you have learned how to use backgrounds in your tables. I realize this tutorial is geared towards the person who actullay understands how to write html code, but I feel that anyone who wants to tweak thier web pages until they look "just right" eventually breaks down and learns html.

(The next paragraph is for Netscape users)

Well here is the bad news. Remember earlier I stated you could:

place a backgound in a page;
place a background in a table;
and place a backgound in a table cell.

Netscape does not currently support placing a background in a table. Netscape only supports having a background in a page and having a background in a table cell. As seen throughout this tutorial, what Netscape does when you specify a table background is to copy it into each individual table cell. I hope in the future Netscape will implement the use of a table background.

(We now return to the tutorial.)

Should you use table backgrounds in your tables? Of course! The only thing to be aware of is that your web pages WILL look differently depending on the web browser used to view them. Just go the extra step and check your work to insure the end result looks acceptable with either one. The reason Manny's Site has "Best viewed with Microsoft IE" displayed should now be obvious. <g>

How do you feel about this short tutorial on using backgrounds with tables? Let me know!


Manny's Site is copyright 1997-2001 by Manuel Revilla, all right reserved.