XHTML 1.1 Tutorial

Tables

Tag Purpose
<table> Defines a table
The <table> defines a table. A table is a structural presentation of data using rows and columns. Inside a <table> tag you can put table headers, table rows, table cells, and other tables. This is the example of how to use <table> and result:
<table border="1">
   <caption>this is the caption</caption>
   <tr>
     <th colspan="2">This is the header</th>
   </tr>
   <tr>
     <td>Cell A</td>
     <td>Cell B</td>
  </tr>
 </table>
		
this is the caption
This is the header
Cell A Cell B
The "align" and "bgcolor" attributes of the table element are not supported in XHTML 1.0 Strict DTD. They can instead be defined in <style> or CSS.
<caption> Defines a table caption
It is used to define a table caption, the description of table. The <caption> tag must be inserted immediately after the <table> tag and must have only one caption per table. The caption will be centered above the table. Like <table>, "align" attribute cannot be used, it must define in <style> or CSS where other font declaration can be applied.
<th> Defines a table header
The <th> tag is used to create a headerfor the cells in a row in a table element. It provides a caption, name, or information about the column of cells as you wish to input. The header text will be displayed in a bold font style.
<tr> Defines a table row
The <tr> element is used to create a row in a table element. You can create as many rows as you wish. The <tr> tag should never appear inside of a <th>, <td>, or other <tr> tags.
<td> Defines a table cell
The <td> tag is used to create cells, in a table row, that contain the data you wish to display in the table. You may place as many data cells in a row.


Previous Next

This tutorial is final project for INFSCI 2000, Fall 2004
Copyright 2004 School of Information Science, University of Pittsburgh