table tag
tr tag
th tag
td tag
tfoot tag
tbody tag
caption tag
col tag
colgroup tag
TAG: thead
<thead> ... </thead>
The
thead
tag is one of three tags that divide a
table
into three distinct sections.
The
tbody
tag defines the body portion where the data is displayed, the
thead
tag defines the header section, and the
tfoot
tag defines the footnote section of the
table
. The purpose of this division is to allow scrolling through the body of a large table while both the header and footnote portions remain visible and fixed in place.
The separate closing tag is mandatory.
Attributes and Events
class
dir
id
lang
onclick
ondblclick
onkeydown
onkeypress
onkeyup
onmousedown
onmousemove
onmouseout
onmouseover
onmouseup
style
title
align
The
align
attribute is used to set the horizontal alignment of the cell contents for all of the cells in a single row. The five permitted values are
center, char, justify, left,
and
right
.
char
The
char
attribute permits you to select a character that will be used to align the contents of all of the rows in a cell. This was designed to allow the decimal points in a column of numbers to be in vertical alignment. The default value is country dependent. In the U.S., it is the first occurrence of a period or a decimal point.
charoff
The
charoff
attribute is an integer used to specify if the value designated in the
char
attribute is to be the first, second, or whatever occurrence.
valign
The
valign
attribute is used to set the vertical alignment of the cell contents for all of the cells in a single row. The possible values are
baseline, bottom, middle,
and
top
.
Note the the correct order for using these tags is
thead,
then
tfoot
, and last
tbody
.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="eng">
<head>
<title>DevGuru XHTML thead Tag Example</title>
</head>
<body>
<table border="1">
<caption>
<b>TABLE</b>
<br />
thead, tfoot & tbody
</caption>
<
thead
>
<tr><th>Header 1</th><th>Header 2</th></tr>
<
/thead
>
<tfoot>
<tr><td colspan="2">footnote</td></tr>
</tfoot>
<tbody>
<tr><td>data cell 1</td><td>data cell 2</td></tr>
</tbody>
</table>
</body>
</html>
Output:
TABLE
thead, tfoot & tbody
Header 1
Header 2
footnote
data cell 1
data cell 2
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information