martin2k

The TD Tag

HomeForumTutorials Tags:
 
 

Name

Table Data

Description

Defines a cell in a table.  It is used within the TR (table row) tag.

Attributes

ALIGN

Aligns the text in the cell - set to either 'left', 'center', 'justify' or 'right'.

BACKGROUND

Sets the background picture for the cell.  To show to an image on the same site use the local path e.g. src="button.gif" or src="folder/photo1.jpg".  You can also use dots to link to an image in the parent folder e.g. src="..\diagram.png".  To show a picture from another site, use the full URL e.g. src="http://www.martin2k.co.uk/tgflogo.gif".

BGCOLOR

Specifies the background colour of the cell.  If the BACKGROUND attribute is also used, the image will cover the background colour unless the background image contains transparent areas.

BORDERCOLOR

Specifies the border colour.  Style sheets should be used instead.

BORDERCOLORDARK

Specifies the border colour on the left and bottom.  Style sheets should be used instead.

BORDERCOLORLIGHT

Specifies the border colour on the right and top.  Style sheets should be used instead.

COLSPAN

Specifies the number of columns the cell will span.

HEIGHT

Specifies the height of the cell in pixels or per cent.

NOWRAP

Set if you do not want text to wrap in the cell.

ROWSPAN

Specifies the number of rows the cell will span.

VALIGN

Vertically aligns the text in the cell - set to either 'baseline', 'bottom', 'middle' or 'top'.

WIDTH

Specifies the width of the cell in pixels or per cent.

Defining Colours

Colours can be defined in this format: #RRGGBB where the values are in hexadecimal format.  E.g. #FF0000 is red.  Colours can also be defined with words e.g. red.

Related Tags

This tag is used within the TR tag, which is used within the TABLE tag.  The TH tag can be used instead to define a header cell.

Other tags related to tables include TBODY, TFOOT and THEAD.

Example

Code

<table border="1" width="100%" bgcolor="#FFFFFF">
  <tr>
    <td width="25%" valign="top" align="center" height="50"><font color="#000000">Cell Text</font></td>
    <td width="25%">&nbsp;</td>
    <td width="25%">&nbsp;</td>
    <td width="25%">&nbsp;</td>
  </tr>
  <tr>
    <td width="25%">&nbsp;</td>
    <td width="25%">&nbsp;</td>
    <td width="25%">&nbsp;</td>
    <td width="25%">&nbsp;</td>
  </tr>
  <tr>
    <td width="50%" colspan="2">&nbsp;</td>
    <td width="25%" bgcolor="#00FFFF" bordercolor="#800000" bordercolorlight="#FF00FF" bordercolordark="#000080">&nbsp;</td>
    <td width="25%" rowspan="2">&nbsp;</td>
  </tr>
  <tr>
    <td width="25%">&nbsp;</td>
    <td width="25%" background="area4.gif">&nbsp;</td>
    <td width="25%">&nbsp;</td>
  </tr>
</table>

Generates

Cell Text      
       
     
     

 


Please fill in the below form if you have any comments or additional information you want to add about the above information.  If you have any questions, please visit the ForumAny questions sent using this form will be ignored.

* - Mandatory

*Name: E-mail:

*Comments:

*Please type the following code (your comment cannot be accepted without it):


© Martin Allen 1999 - 2006.  Last updated Thursday 09 November 2006 10:07:03 PM -0000.