Understanding HTML tables Part 3

Borders width cellpadding background images rowspan
alignment height cellspacing background colour colspan

Table Attributes

There are various attributes you can use in your tables which will change the way they are displayed. By doing this, you can display your tables/data exactly how you want it displayed on your page.

You can use all of the attributes in the one tag, for example:



 

Borders






setting the width of the border and bordercolour
setting the width of the border
and bordercolour






border width set to 6
border width set to 6






border set to zero, no need for bordercolour!
border set to zero, no need for bordercolour!


Cellpadding and Cellspacing






If you don't set the cellpadding and cellspacing, it naturally uses a 1px space. To gain greater control, set them.
If you don't set the cellpadding and cellspacing, it naturally uses a 1px space. To gain greater control, set them.






cellpadding set to 10
cellpadding set to 10






cellspacing set to 10
cellspacing set to 10






cellspacing and cellspacing set to 10
cellspacing and cellspacing set to 10