The element creates table headers, which are usually displayed centered and in bold text.. Supported in XHTML 1.0 Transitional and XHTML 1.0 Frameset.. colspan Specifies the number of c
Trang 1The <th> element creates table headers, which are usually
displayed centered and in bold text These headers label the columns in a table The <th> element is supported in XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, and XHTML 1.1 Here are its attributes:
abbr Specifies an abbreviated name for a header
(Supported in XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, and XHTML 1.1.)
align Specifies the horizontal alignment Possible values are left, center, right, justify, and char (Supported in XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0
Frameset, and XHTML 1.1.)
axis Specifies a name for a cell This attribute is normally used only with table heading cells (Supported in XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, and XHTML 1.1.)
bgcolor Specifies the background color of table cells This attribute was deprecated in HTML 4.0 (Supported in XHTML 1.0 Transitional and XHTML 1.0 Frameset.)
char Specifies a character to align text with respect to
(Supported in XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, and XHTML 1.1.)
charoff Sets the alignment offset (Supported in XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, and XHTML 1.1.)
Trang 2in XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, and XHTML 1.1.)
colspan Specifies the number of columns of the table that the header should span (the default is 1) (Supported in XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0
Frameset, and XHTML 1.1.)
dir Sets the direction of directionally neutral text This
attribute can be set to ltr, for left-to-right text, or rtl, for right-to-left text (Supported in XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, and XHTML 1.1.)
headers Specifies a list of header cells (Supported in
XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0
Frameset, and XHTML 1.1.)
height Specifies the height of the header, in pixels This attribute was deprecated in HTML 4.0 (Supported in XHTML 1.0 Transitional, XHTML 1.0 Frameset.)
id Specifies the ID of the element (Supported in XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, and XHTML 1.1.)
lang Specifies the base language of the element
(Supported in XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, and XHTML 1.1.)
nowrap Specifies that the browser should not wrap text by adding line breaks This attribute was deprecated in HTML 4.0 (Supported in XHTML 1.0 Transitional and XHTML 1.0 Frameset.)
Trang 3rowspan Specifies the number of rows of the table that the header should span (Supported in XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, and XHTML 1.1.)
scope Specifies a set of data cells for which the header cell gives header information Possible values are row, col,
rowgroup, and colgroup (Supported in XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, and XHTML 1.1.)
style Indicates how a browser should display the element You should set this to an inline style (Supported in XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, and XHTML 1.1.)
title Specifies the title of the element (Supported in
XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0
Frameset, and XHTML 1.1.)
valign Specifies the vertical alignment of the data in the cell Possible values are top, middle, bottom, and
baseline (Supported in XHTML 1.0 Strict, XHTML 1.0
Transitional, XHTML 1.0 Frameset, and XHTML 1.1.)
width Specifies the width of the header This attribute was deprecated in HTML 4.0 (Supported in XHTML 1.0
Transitional, XHTML 1.0 Frameset.)
xml:lang Specifies the base language for the element when the document is treated as XML (Supported in XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, and XHTML 1.1.)
Here's how you might create headers if you wanted to display data from the states example from Day 9, "Formatting XML by
Trang 4<table>
<tr>
<th>State</th>
<th>Bird</th>
<th>Flower</th>
</tr>
</table>
This example creates three table headers on top of three columns: State, Bird, and Flower
TIP
XHTML headers can span several columns if you use the colspan attribute
Trang 5Yesterday you saw that you can use CSS to format XML
documents in the major browsers (Internet Explorer and
Netscape Navigator) However, there's a native XML way to format XML documents for displayusing Extensible Stylesheet Language Transformations (XSLT), which is what you'll discuss today Here's an overview of today's topics:
Transforming XML in the server, in the client, and with
standalone programs
Creating an XSLT style sheet
Creating and applying templates
Getting node values
Handling multiple selections
Using the match and select attributes
Matching element, processing instructions, and other nodes
Working with XPath
Creating XPath node tests
Copying nodes to the output document
Making decisions in XSLT based on input data