o now you're ready to add a background color to your table. It's relatively simple. All you have to do is write bgcolor="#color" inside your TABLE tag, like this:
ow let's see it in action:
kay, what about making the cells several different colors? You can do that by adding a background color to each cell individually. You write in the TD tag like this:
You can add color by table row also. Just write bgcolor="#color" inside your TR tag. You can make each row a different color like so:
ow can you see how easy it is to add color? You can make each row or each cell any color you want.
et's talk about the TABLE attributes called CELLPADDING and CELLSPACING. Both are used in the <TABLE> tag. CELLPADDING is the amount of space between the border of the cell and the contents of the cell. And cellspacing is the amount of space BETWEEN cells. Here is an example of CELLPADDING. This puts more space between the contents and the edges of the cell.
Now take a look at the difference between CELLSPACING and CELLPADDING. There is now space BETWEEN the cells.
The default value for CELLPADDING is 1 and the default value for CELLSPACING is 2. To write in CELLSPACING and CELLPADDING, you simply place these attributes inside the TABLE tag, like so:
Now what if we wanted to use these attributes together. See for yourself below how this would look combining cellspacing and cellpadding:
Now you can set your tables the way you want them. That's it for this lesson. Now go practice your tables. Then move right along to Lesson 12.