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.
HTML Reference
-
HTML Tutorial
Free HTML tutorial that explains how to code in HTML.
This tutorial explains what HTML elements and attributes are, and how to use them.
I explain the basics, such as what you need in order to write HTML and how to create your first web page.
I then cover other HTML topics including tables, adding color, images, forms, image maps, iframes, meta tags, and more.
I also explain the difference between HTML and CSS (and when to use each one).
Go to HTML Tutorial -
HTML Tags
Full list of all HTML elements.
This is an alphabetical list of HTML elements, linking to a full page of details for each element.
All elements are based on the official HTML5 specification, and include usage notes, full attribute list, as well as links to the various specifications for each element (i.e. HTML4 spec, HTML5 spec, WHATWG spec).
Go to HTML Tags -
CSS Properties
Full list of CSS properties.
Alphabetical list of CSS properties as per the W3C specifications.
CSS stands for Cascading Style Sheets. CSS is the standard way to style web pages.
You can use CSS to set the style for a whole website in one place. CSS allows you to set colors, fonts, widths, heights, margins, padding, and much more.
Go to CSS Properties