Home

1. Introduction

2. Basics review

3. WIDTH

4. VALIGN

5. BORDER

6. BGCOLOR

7. CELLSPACING

8. CELLPADDING

9. ALIGN

10. Table manners

11. Editors

12. Summary

13. Exercises



Classes home

HTML Info home

 

BGCOLOR

BGCOLOR adds a background color to entire tables, entire rows, entire columns, or individual cells.

The slightly tricky part is specifying the colors.Colors on the web are most commonly specified in hexidecimal format (a base-16 number system), so that red is #FF0000, for example. On this page, the green background is #666633, while the khaki gutter to the left is #cccc99.

This isn't a huge problem, though, with most HTML or graphics editors, which allow you to pick colors, and then supply the hex value for the color you chose.

You can also find lots of utilities on the net which supply hex values for color choices.

You can also just type a color in as a value. A commonly accepted Netscape extension is the plain English names for several dozen color varieties. The variations become as complex as a lipstick display, but basic names are pretty much what you'd expect - red, yellow, blue, brown, etc.

Before code: table without BGCOLOR

   <table border=1 width="100%">
     <tr>
        <td width="20%" valign="top">Return..</td>
        <td width="80%">Welcome..</td>
     </tr>
   </table>

Before results: table without BGCOLOR

Return to home

Welcome to my home page. I'm so glad that you're here!

Be sure to sign my guestbook and register for my free drawing. A new winner will be picked every month!

Also, don't forget to play my new Java-enhanced "Whack-a-Bill" game in the "Games and Entertainment" area.

Thank you for coming by!

After code: table with BGCOLOR

   <table border=1 width="100%" bgcolor="pink">
     <tr>
        <td width="20%" bgcolor="tan">Return..</td>
        <td width="80%">Welcome..</td>
     </tr>
   </table>

Before results: table with BGCOLOR

Return to home

Welcome to my home page. I'm so glad that you're here!

Be sure to sign my guestbook and register for my free drawing. A new winner will be picked every month!

Also, don't forget to play my new Java-enhanced "Whack-a-Bill" game in the "Games and Entertainment" area.

Thank you for coming by!

Note 1: Color on the web is a complex issue. Basically, there are 216 "safe" colors that you can be sure will be the same on everyone's browser, and thousands more that may or may not work. Try to pick your code colors from the browser safe palette. Two places to find the palette are

Note 2: Do everything you can to avoid using light text on a dark background. Light text does not print well.

Note 3: This isn't a table code, but is worth mentioning here: if you use a background graphic, you should still specify a background color, especially if you ignore Note 2 and use light text on a dark background. This way users who have images turned off, or who don't wait for your background to download, will still see something.