<table
cellpadding="pixels" <td
align="position" |
Spacing in between table cells Horizontal alignment of cell content Vertical alignment of cell content |
cellspacing
and cellpadding
attributes are used in the <table>
tag and apply to all cells in the respective table. The align
and valign
attributes are used in individual <td>
tags and apply respectively to that particular table data cell. cellpadding="length in pixels"
~ The cellpadding
attribute, used in the <table>
tag, specifies how much blank space to display in between the content of each table cell and its respective border. The value is defined as a length in pixels. Hence, a cellpadding="10"
attribute-value pair will display 10 pixels of blank space on all four sides of the content of each cell in that table. (See Example 1)
cellspacing="length in pixels"
~ The cellspacing
attribute, also used in the <table>
tag, defines how much blank space to display in between adjacent table cells and in between table cells and the table border. The value is defined as a length in pixels. Hence, a cellspacing="10"
attribute-value pair will horizontally and vertically separate all adjacent cells in the respective table by a length of 10 pixels. It will also offset all cells from the table's frame on all four sides by a length of 10 pixels. align="left, center or right"
~ When the align
attribute is used in a <td>
tag as opposed to a <table>
tag, it produces a slightly different effect. When used in a <td>
tag, the align
attribute will set the horizontal alignment of that respective cell's content. The value can be left
, right
, center
or justify
. (Please see Aligning Text for a full description of the resulting effects.)
valign="top, middle, or bottom"
~ The valign attribute can be used in a <td>
tag to set the vertical alignment of that respective cell's content. The values that can be used are top
, middle
, or bottom
and will produce the following effects respectively:top
~ The content is aligned flush with the top of the table cell (taking cellpadding into consideration).
middle
~ The content is aligned in the vertical center of the table cell (default value).
bottom
~ The content is aligned flush with the bottom of the table cell (taking cellpadding into consideration).
<table border="3" bordercolor="#c86260" bgcolor="#ffffcc" width="50%" cellspacing="2" cellpadding="3">
<tr><td><b>Breakfast</b></td><td>Orange juice<br>Toast<br>Black coffee</td></tr>
<tr><td><b>Lunch</b></td><td>Tuna sandwich<br>Apple</td></tr>
<tr><td><b>Dinner</b></td><td>Hamburger steak<br>Mashed potatoes<br>Green beans<br>Jello</td></tr>
</table>
Breakfast | Orange juice Toast Black coffee |
Lunch | Tuna sandwich Apple |
Dinner | Hamburger steak Mashed potatoes Green beans Jello |
<table border="3" bordercolor="#c86260" bgcolor="#ffffcc" width="50%" cellspacing="2" cellpadding="3">
<tr><td valign="top"><b>Breakfast</b></td><td>Orange juice<br>Toast<br>Black coffee</td></tr>
<tr><td valign="top"><b>Lunch</b></td><td>Tuna sandwich<br>Apple</td></tr>
<tr><td valign="top"><b>Dinner</b></td><td>Hamburger steak<br>Mashed potatoes<br>Green beans<br>Jello</td></tr>
</table>
Breakfast | Orange juice Toast Black coffee |
Lunch | Tuna sandwich Apple |
Dinner | Hamburger steak Mashed potatoes Green beans Jello |
Free Text Editors
Free Graphics Editors
Website Analysis Tools
Free Website Templates
See also:
If you need a .COM web address, you can get one quick and easy at...
<~BACK | TOP | NEXT~> |