asp.net.ph

Skip Navigation Links

TABLE Element | TABLE Object

Language References


Defines a table.HTML 3.2, 4, 4.01, 5

HTML Syntax

Remarks

The TABLE element specifies a container for arranging content into rows and columns of cells.

TABLE elements are always used with the TR element to define the table rows, and the TH or TD elements to define the table cells. TH elements define row or column headings, and TD elements define the cells for the table data.

A TABLE can also contain a CAPTION element, which provides a label of the table's purpose.

A TABLE can have a specified width and height, and browsers render the table to fit the specified dimensions when possible. In cases where the specified sizes will not fit, as when the table may have cells that contain long non-wrapping lines, the browser adjusts the table size accordingly.

The cols attribute can be used to specify the number of equal-width columns in the table. Specifying this attribute can speed up the processing of a table.

To control spacing between and within cells, authors can use cellspacing to specify the distance between cells, and cellpadding to specify the distance between the border and content of each cell.

When a document is loading, modifications to a table are restricted until the window.onload event occurs. Read-only access is allowed at any time.

The TABLE Object Model is read-only for databound tables. For example, script to remove a table row will work correctly on an unbound table, but will not work on a databound table. The TABLE object’s properties are still available, but changes to the bound table's data have to be made to the data source.

Members

TABLE Members

Example

This example demonstrates a table with two rows and two columns.

<table width=80%>
<thead>
<tr>
   <th>Heading 1</th>
   <th>Heading 2</th>
</tr>
<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>
</table>
See Also

TD   TH   TR   Using Tables



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note