th Creating Table Headings

<th> Creating Table Headings

You use the <th> element to create table headings, which are usually displayed in bold text, and label the columns in a table. This 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 Holds an abbreviated name for a header. (XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, XHTML 1.1.)

  • align Sets the horizontal alignment of content in table cells . Possible values are left , center , right , justify , and char . (XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, XHTML 1.1.)

  • axis Contains a name for a cell (usually used only with table heading cells). Allows the table to be mapped to a tree hierarchy. (XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, XHTML 1.1.)

  • bgcolor Deprecated in HTML 4.0. Sets the background color of table cells. (XHTML 1.0 Transitional, XHTML 1.0 Frameset.)

  • char Specifies a character to align text on. (XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, XHTML 1.1.)

  • charoff Sets the alignment offset to the first character to align on (which you set with char ). (XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, XHTML 1.1.)

  • class Gives the style class of the element. (XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, XHTML 1.1.)

  • colspan Specifies how many columns of the table this header should span (the default is 1 ). (XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, XHTML 1.1.)

  • dir Sets the direction of text that doesn't have an inherent direction in which you should read it, called directionally neutral text. You can set this attribute to ltr , for left-to-right text, or rtl , for right-to-left text. (XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, XHTML 1.1.)

  • headers Specifies a list of header cells that supply header information. (XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, XHTML 1.1.)

  • height Deprecated in HTML 4.0. Sets the height of the header in pixels. (XHTML 1.0 Transitional, XHTML 1.0 Frameset.)

  • id Refers to the element; set this attribute to a unique identifier. (XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, XHTML 1.1.)

  • lang Specifies the base language used in the element. Applies only when the document is interpreted as HTML. (XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, XHTML 1.1.)

  • nowrap Deprecated in HTML 4.0. Indicates that content should not be wrapped by the browser by adding line breaks. (XHTML 1.0 Transitional, XHTML 1.0 Frameset.)

  • rowspan Specifies how many rows of the table this header should span. (XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, XHTML 1.1.)

  • scope Specifies a set of data cells for which the header cell provides header information. You can set this to row , col , rowgroup , or colgroup . (XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, XHTML 1.1.)

  • style Inline style indicating how to render the element. (XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, XHTML 1.1.)

  • title Contains the title of the element. (XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, XHTML 1.1.)

  • valign Sets the vertical alignment of the data in this cell. You can set this to top , middle , bottom , or baseline . (XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, XHTML 1.1.)

  • width Deprecated in HTML 4.0. Gives the width of the header. (XHTML 1.0 Transitional, XHTML 1.0 Frameset.)

  • xml:lang Specifies the base language for the element when the document is interpreted as an XML document. (XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, XHTML 1.1.)

Here are the XHTML events supported by this element: onclick , ondblclick , onfocus , onblur , onmousedown , onmouseup , onmouseover , onmousemove , onmouseout , onkeypress , onkeydown , and onkeyup .

You use the <th> element to put a header on top of columns in a table. Headers like these can span several columns if you use the colspan attribute. Here's an example:

 <table>      <tr>  <th>TIC</th>   <th>TAC</th>   <th>TOE</th>  </tr>     .     .     . </table> 

This adds three table headers on top of three columns: TIC , TAC , and TOE . The next step is adding cells to the table that can contain some data, and you do that with the <td> element.



Real World XML
Real World XML (2nd Edition)
ISBN: 0735712867
EAN: 2147483647
Year: 2005
Pages: 440
Authors: Steve Holzner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net