HTML Tables
This page contains HTML table code - HTML codes for specifying or changing the look of your tables within your blog or web page.
HTML tables are created using the HTML <table>
tag along with other tags that are nested inside it (such as the <tr>
and <td>
elements). The look and style of your tables is defined using Cascading Style Sheets (CSS).
Here, you can find heaps of examples that demonstrate how you can change the look of your tables.
Basic Table Code:
Table Text
Example:
Table header | Table header |
---|---|
Table cell 1 | Table cell 2 |
Table cell 3 | Table cell 4 |
Table Borders
Example:
Table header | Table header |
---|---|
Table cell 1 | Table cell 2 |
Table cell 3 | Table cell 4 |
Table Background Color
Example:
Table header | Table header |
---|---|
Table cell 1 | Table cell 2 |
Table cell 3 | Table cell 4 |
Table Background Image
Example:
Table header | Table header |
---|---|
Table cell 1 | Table cell 2 |
Table cell 3 | Table cell 4 |
HTML Table Elements
In HTML, tables are created using the following elements:
<table>
- Represents the table.
<tr>
- Represents a table row within a table.
<td>
- Represents a cell (or table data) within the table.
<th>
- Represents a table header cell.
tbody
- Represents a block of rows that consist of a body of data for its parent table.
thead
- Represents the block of rows that consist of the column labels (headers) for its parent table.
tfoot
- Represents the block of rows that consist of the column summaries (footers) for the parent table.
caption
- Represents the title of its parent table.
colgroup
- Represents a group of one or more columns in its parent table.
col
- Used for specifying column properties for each column within a colgroup.
See the table tutorial for more information and examples.