table Creating Tables

<table> Creating Tables

The <table> element is always a popular one, and you use it to create tables. To build a table, you enclose other elements in <table> , such as <caption> , <tr> , <th> , <td> , <colspan> , <col> , <thead> , < tbody > , and < tfoot > . 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:

  • align Deprecated in HTML 4.0. Sets the horizontal alignment of the table in the browser window. You can set this to left , center , or right . (XHTML 1.0 Transitional, XHTML 1.0 Frameset.)

  • bgcolor Deprecated in HTML 4.0. Sets the background color of table cells . Even though this attribute is deprecated, stylesheet support for tables is still limited and inconsistent across browsers. (XHTML 1.0 Transitional, XHTML 1.0 Frameset.)

  • border Sets the border width, as measured in pixels. If you set this attribute to , the border is invisible. (XHTML 1.0 Transitional, XHTML 1.0 Frameset.)

  • cellpadding Specifies the spacing between cell walls and cell contents in pixels. (XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, XHTML 1.1.)

  • cellspacing Specifies the distance between cells. Set this to a value in pixels. (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.)

  • 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.)

  • frame Determines the outer border display of the table using the Complex Table Model. You use this attribute with the rules attribute. Possible values are void (no borders), above (border on top side only), below (border on bottom side only), hsides (horizontal borders only), vsides (vertical borders only), lhs (border on left side only), rhs (border on right side only), box (border on all four sides), and border (the default, the same as box ). (XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, XHTML 1.1.)

  • 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.)

  • rules Specifies the interior struts in a table using the Complex Table Model. You can set this to none (no interior struts), groups (horizontal struts displayed between table groups created with the thead , tbody , tfoot and colgroup tags), rows (horizontal struts displayed between all table rows), cols (vertical struts displayed between all table columns ), and all (struts displayed between all table cells). (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.)

  • summary Gives summary information for nonvisual browsers. (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.)

  • width Sets the width of the table. Set this to a pixel value or a percentage of the display area (add a percent sign [ % ] to such values). (XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, XHTML 1.1.)

  • 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 that this element supports: onclick , ondblclick , onfocus , onblur , onmousedown , onmouseup , onmouseover , onmousemove , onmouseout , onkeypress , onkeydown , and onkeyup .

The <table> element is what you use to create tables in XHTML. To create a table, you enclose everything in a <table> element:

 <table>      .     .     . </table> 

That creates a table, but nothing happens on the screen with this markupyou need to give the table some rows. See the next section to start fleshing things out.



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