th Element


 

Module

The th element is declared by the XHTML 1.1 Tables Module

Elements in the Tables Module are:
table | caption | col | colgroup | thead | tfoot | tbody | tr | th | td

Description

The th element is used to specify a pure header cell within a table. A table can contain both pure header cells and also data cells (which are specified by the td element). Cells created using th are, by default, usually displayed by user agents differently than those created by td - possibly using a bold typeface and/or centred text.

Any cell which functions as both a header cell and a data cell - and thus is not a pure header cell - should be specified by td (rather than th) and either a scope attribute or headers attributes should be used to indicate the cells for which it is a header. Of course, it is also possible - and common - to use either the scope or the headers method to indicate the cells for which a th element is a header.

Any table cell's contents may be assigned an abbreviation (using the abbr attribute) or longer, explanatory text (using the common title attribute).

A single cell can be made to span more than one table row and/or column by adding a rowspan and/or colspan attribute to the cell. See the tr element for more information. Although it is usually preferable to use CSS for purely presentational matters, it is possible to control the alignment of text within a cell using its align and/or valign attributes.

#REQUIRED Attributes

There are no #REQUIRED attributes on the th element.


Specific Attributes

Specific attributes of the th element are listed below:

From the Tables Module - the Element's own Module

abbr [ type Text ]
An abbreviation for the cell's content
align [ type Enumeration (left | center | right | justify | char) ]
Horizontal alignment of text within the cell
axis [ type CDATA ]
Used to categorise the cell to make it easier to interpret the table - see the W3C documentation at *HTML 4.01 - Categorising cells for detailed information (albeit for HTML rather than XHTML). Currently, user agent support of this attribute is very poor.
char [ type Character ]
When the align attribute is set to "char", this specifies a single character at which to align the contents of the cell
Note: User agents are not obliged to support this attribute (in fact I don't know of any which do)
charoff [ type Length ]
Offset within the cell of the first occurrence of the alignment character char (again, I don't know of any user agents which support this attribute)
colspan [ type Number - default="1" ]
The number of columns to be spanned by the cell
headers [ type IDREFS ]
A space-separated list of header cell id values which apply to the current cell
rowspan [ type Number - default="1" ]
The number of rows to be spanned by the cell
scope [ type Enumeration (row | col | rowgroup | colgroup) ]
Indicates for which cells the current cell is a header
valign [ type Enumeration (top | middle | bottom | baseline) ]
Vertical alignment of text within the cell

Common Attributes

Common attributes of the th element are listed below:

From the Core Attribute Collection

class [ type NMTOKENS ]
One or more space separated classes
id [ type ID ]
A unique identifier for the element
style [ type CDATA ], from the Style Attribute Module (deprecated)
Element-specific styles
title [ type Text ]
Descriptive title for the element (in some user agents this may appear as a "tooltip" when the mouse hovers over the element)
xmlns [ type URI - #FIXED 'http://www.w3.org/1999/xhtml' ]
XML namespace

From the I18N Attribute Collection

dir [ type Enumeration (ltr | rtl) ], from the Bi-directional Text Module
Left-to-right or right-to-left directionality
xml:lang [ type LanguageCode ]
A language code for the element

From the Events Attribute Collection

All attributes in the Events Attribute Collection are supported:
onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup


Content Model

The Content Model for the th element is:

( #PCDATA | Flow.mix )*

See Content Model & Nesting for information about Content Model syntax and Nesting Groups.

Valid children of th

Valid parents of th


Page Footer & Copyright

Copyright © Sally Maughan 2005-2009 (Page last updated on 01 Oct 2009)

*Valid XHTML 1.1 - hosted by *Openstrike

Content based on the W3C Working Draft: *XHTML 1.1 and Recommendation: *XHTML Modularisation 1.1.

W3C, XHTML, XML, HTML, CSS and MathML are *Trademarks of the W3C (*MIT, *ERCIM, *Keio) with which the site's author has no connection.


Up, Next & Previous Links

Your Location

Home > XHTML 1.1 Home > XHTML 1.1 Indexes > Element Index (XHTML 1.1) > th Element