table

< html‎ | elements
Jump to: navigation, search

table



Summary

Defines an HTML table.


Overview Table

DOM Interface HTMLTableElement

Examples

This example uses the TABLE element with THEAD, TR, and TH to create a table with three rows and two columns.

<TABLE BORDER=1 WIDTH=80%>
<THEAD>
<TR>
<TH>Heading 1</TH>
<TH>Heading 2</TH>
</TR>
</THEAD>
<TBODY>
<TR>
<TD>Row 1, Column 1 text.</TD>
<TD>Row 1, Column 2 text.</TD>
</TR>
<TR>
<TD>Row 2, Column 1 text.</TD>
<TD>Row 2, Column 2 text.</TD>
</TR>
</TBODY>
</TABLE>

Notes

Remarks

The following tags are valid in table construction: CAPTION, COL, COLGROUP, TBODY, TD, TFOOT, TH, THEAD, and TR. For each table object, only one tHead and tFoot can be specified. While a document loads, modifications to a table are restricted until the onload event occurs. Read-only access is allowed at any time. The table object model is read-only for databound tables. For example, script used to remove a table row works correctly on an unbound table, but not on a databound table. The properties of a table object are still available, but changes to the bound data in a table must be made to the data source. The properties of a table are distinct from the properties of cells contained within the table. For example, the offsetLeft property of a multicolumn table is not the same as the offsetLeft property of the left-most cell in the table. Refer to the appropriate object when writing scripts involving table objects, cell objects, or both. The table object and its associated elements have a separate table object model, which uses different methods than the general object model. For more information on the table object model, see Building Tables Dynamically. When scripting the pixelHeight or posHeight property to numerically manipulate the height value. If dynamic changes are intended for the height and width, the original values should be set through style (for example, style="height:200px; width:200px") rather than through the height and width attributes. Many styles do not inherit to a table and its contents from its parent object. Among these are: font-size; font-weight; line-height; text-align; font-style; font-variant. Windows Internet Explorer 8 will only render tables up to 1000 columns. To force Windows Internet Explorer 7 rendering mode, see How Do I Take Advantage of the New Features in Internet Explorer 8.

Standards information


HTML information

{

Compatibility

Desktop

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support ? ? ? ? ?

Mobile

Feature Android BlackBerry Chrome for mobile Firefox Mobile (Gecko) IE Mobile Opera Mobile Opera Mini Safari Mobile
Basic support ? ? ? ? ? ? ? ?

See also

Related pages (MSDN)

  • Building Tables Dynamically

This article contains content originally from external sources.

Portions of this content come from the Microsoft Developer Network: [Windows Internet Explorer API reference Article]