martin2k

The TH Tag

HomeForumTutorials Tags:
 
 

Name

Table Header Data

Description

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

Text used within this tag is usually centred and made bold.

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 TD tag is used to define a normal cell.

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

Example

Code

<table border="1" width="100%">
  <tr>
    <th width="50%">Name</th>
    <th width="50%">Country</th>
  </tr>
  <tr>
    <td width="50%">Francis</td>
    <td width="50%">USA</td>
  </tr>
  <tr>
    <td width="50%">Constance</td>
    <td width="50%">Italy</td>
  </tr>
</table>

Generates

Name Country
Francis USA
Constance Italy

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:16 PM -0000.