XHTML
(eXtensible HyperText Markup Language)

Tags for Adding Tables and Lists

Go to Lists

Tables: Basic Tags

Tag Pair Tag's Name Usual Attributes (in addition to
class, id, style, title)
<table> </table> Table
  • border (px or %)
  • cellpadding (px or %)
  • cellspacing (px or %)
  • summary
  • width (px or %)
<caption></caption> Caption--OPTIONAL --displays centered over table
<tr> </tr> Row
  • align (left, right, center, justify)
  • valign (top, middle, bottom)
<th> </th> Cell Header--OPTIONAL
(usually displays in boldface type)
[contained between <tr> </tr>]
  • align (left, right, center, justify)
  • colspan
  • rowspan
  • valign (top, middle, bottom)
<td> </td> Data cell
[contained between <tr> </tr>]
  • align (left, right, center, justify)
  • colspan
  • rowspan
  • valign (top, middle, bottom)

A Simple Table

<table border="1px">
  <caption>Table Caption</caption>
  <tr>
    <th>1st Header</th>
    <th>2nd Header</th>
    <th>3rd Header</th>
  </tr>
  <tr>
    <td>1st row, 1st cell</td>
    <td>1st row, 2nd cell</td>
    <td>1st row, 3rd cell</td>
  </tr>
  <tr>
    <td>2nd row, 1st cell</td>
    <td>2nd row, 2nd cell</td>
    <td>2nd row, 3rd cell</td>
  </tr>
</table>  
Table Caption
1st Header 2nd Header 3rd Header
1st row, 1st cell 1st row, 2nd cell 1st row, 3rd cell
2nd row, 1st cell 2nd row, 2nd cell 2nd row, 3rd cell

A Slightly Less Simple Table

<table border="1px">
  <caption>Table Caption</caption>
  <tr>
    <th colspan="2">1st-2nd columns</th>
    <th>3rd Column</th>
  </tr>
  <tr>
    <td>1st row, 1st cell</td>
    <td rowspan="2">1st row, 2nd cell 
      (2 rows tall)</td>
    <td>1st row, 3rd cell</td>
  </tr>
  <tr>
    <td>2nd row, 1st cell</td>
    <td>2nd row, 2nd cell</td>

  </tr>
</table>    
Table Caption
1st-2nd columns 3rd Column
1st row, 1st cell 1st row, 2nd cell (2 rows tall) 1st row, 3rd cell
2nd row, 1st cell 2nd row, 2nd cell

Lists

Unordered Lists
<ul>
  <li>An unordered list item</li>
  <li>Another unordered list item</li>
  <li>Yet another unordered list item</li>
</ul>
  • An unordered list item
  • Another unordered list item
  • Yet another unordered list item
Ordered Lists
<ol>
  <li>First ordered list item</li>
  <li>Second ordered list item</li>
  <li>Third ordered list item</li>
</ol>
  1. First ordered list item
  2. Second ordered list item
  3. Third ordered list item
Definition Lists
<dl>
  <dt>Definition term</dt>
     <dd>Definition description</dd>
  <dt>Another definition term</dt>
     <dd>Its definition description</dd>
</dl>
Definition term
Definition description
Another definition term
Its definition description