Form
the table is defined by the <table> tag . Each table has several rows (defined by the <tr> tag) and each row is split into several cells (defined by the <td> tag). The letter TD refers to the table data, which is the contents of the data cell. Data cells can contain text, pictures, lists, paragraphs, forms, horizontal lines, tables, and so on.
Empty cells in a table
In some browsers, table cells with no content are not displayed well. If a cell is empty (no content), the browser may not be able to display the border of the cell.
<table border= "1" ><tr><td>row 1, cell 1</td><td>row 1, cell 2</td></tr>< Tr><td></td><td>row 2, Cell 2</td></tr></table>
Note: The border of this empty cell is not displayed. To avoid this situation, add a space placeholder to the empty cell to display the border.
<table border= "1" ><tr><td>row 1, cell 1</td><td>row 1, cell 2</td></tr>< Tr><td> </td><td>row 2, cell 2</td></tr></table>
Table Labels
<table> |
Defining tables |
<caption> |
Defines the table title. |
<th> |
Defines the table header for the table. |
<tr> |
Defines the row for the table. |
<td> |
Defines a table cell. |
<thead> |
Defines the header of the table. |
<tbody> |
Defines the body of the table. |
<tfoot> |
Defines the footer of the table. |
<col> |
Defines the properties used for table columns. |
<colgroup> defines a group of table columns.
Example 1. This example shows how to display a table header.
Example 2. This example shows a table with a caption (caption)
Example 3. This example shows how to define table cells that span rows or across columns.
Example 4. This example shows how to display an element within a different element.
Example 5. This example demonstrates how to use cell padding to create a space between the contents of a cell and its border.
Example 6. This example demonstrates how to use cell spacing to increase the distance between cells.
Example 7. This example shows how to add a background to a table.
Example 8. This example shows how to add a background to one or more table cells.
Example 9. This example demonstrates how to use the Align property to arrange the contents of a cell to create an aesthetically pleasing table.
Example 10. This example demonstrates how to use the Frame property to control the bounding rectangle around a table.
HTML Learning (vii) Table