HTML Tables
HTML TABLES
A table is a grid of rows and columns.
It is used to present information in a mor organized manner-that
is related items are grouped either in one column or in one row.
Data presented in a tabular form is also called a two dimensional
table for the reason that the data are signifi cantly related, not
only vertically, but also horizontal.
A table may have a horizontal heading (top row) or
vertical heading (first column). It may also have a
footer and caption. There is no limit to the number
of columns and rows a table can contain The
following is an example of data presented in a table
with headings and footer.
Tables are defined with the <table> tag. A
row of a table is defined with the <tr> tag.
Each row is divided int data cells. A data
cell is defined with the tag <td>, which
holds the table data. A <td> content
element may be a text, image, list, and
other elements. It can even hold another
table. The <td> elements should be within
the start and end <tr> tags
To specify the headings of a table, use
the tag <th>. Like <td>, the <th> tags
should be with the <tr> start and end
tags. A tag can also have a caption. It is
defined with the <caption> tag. The
<caption> tag is placed, preferably right
after the <table> tag. By default, the
caption is displayed above the table.
A table can be divided into 3 sections:
head, body, and foot
1. Head: To defi ne the head of a table, use the <thead> tag.
2. Body : To defi ne the body of a table, use the <tbody> tag
3. Foot: To defi ne the foot of a table, use the <tfoot> tag.
These tags should be placed in the correct order, the <thead> elements
should be defined first; then the <tfoot> elements, then, the <tbody>
elements
TAG DESCRIPTION
<table> Determines the beginning of a table
<caption> Displays text that describes the content of a table
<colgroup> Groups one or more columns for specific formatting
<col> Defines column properties for a column or groups of columns
<thead> Defines the header or head section of a table
<tfoot> Defines the footer or foot section of a table
<tbody> Defines the body of a table
<tr> Defines a row of table
<th> Creates a heading for a column. By default, the headings are
centered and in bold text
<td> Holds the content data