HTML Basix - HTML tutorials and online webmaster tools


Htaccess code generators Code generators Tutorials

Online and offline code generators


Subscribe to RSS feed
Subscribe to the HTML Basix RSS feed.
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:

<table cellpadding="0" cellspacing="0" border="1" bordercolor="red" align="right" valign="bottom">

Borders

<table border="2" bordercolor="#008080">
<tr>
<td>
setting the width of the border and bordercolour
</td>
</tr>
</table>
setting the width of the border
and bordercolour

<table border="6" bordercolor="#008080">
<tr>
<td>
border width set to 6
</td>
</tr>
</table>
border width set to 6

<table border="0">
<tr>
<td>
border set to zero, no need for bordercolour!
</td>
</tr>
</table>
border set to zero, no need for bordercolour!


Cellpadding and Cellspacing

  • Cellpadding is the distance between the edge of the table data cell and the data within it. It's the 'padding' of the cell.
  • Cellspacing is the distance between the cells themselves.

<table border="2" bordercolor="#008080"cellpadding="0" cellspacing="0">
<tr>
<td>
If you don't set the cellpadding and cellspacing, it naturally uses a 1px space. To gain greater control, set them.
</td>
</tr>
</table>
If you don't set the cellpadding and cellspacing, it naturally uses a 1px space. To gain greater control, set them.

<table border="2" bordercolor="#008080"cellpadding="10" cellspacing="0">
<tr>
<td>
cellpadding set to 10
</td>
</tr>
</table>
cellpadding set to 10

<table border="2" bordercolor="#008080"cellpadding="0" cellspacing="10">
<tr>
<td>
cellspacing set to 10
</td>
</tr>
</table>
cellspacing set to 10

<table border="2" bordercolor="#008080"cellpadding="10" cellspacing="10">
<tr>
<td>
cellspacing and cellspacing set to 10
</td>
</tr>
</table>
cellspacing and cellspacing set to 10




Site Stats     
VisitorsPageviews
Total: 9,286,336 Total: 26,896,823
Today: 355 Today: 950
Yesterday: 668 Yesterday: 2,128
Past Month: 20,708 Past Month: 65,968

604 visitors in the last 24 hours
This page has been visited 28,728 times
There are currently 3 visitors online
click to see where
most people online at once:
286 visitors on 06/27/2012
   You beaut











This site is © HTML Basix 2003 - 2009