Example of a Text Table

    First Name            Last Name
    ---------------       --------------------
    George                Washington
    Abraham               Lincoln
    Bill                  Clinton
    John                  Kennedy
    Richard               Nixon
    

Here is an example of a simple table. Note by default there are no borders on tables, so I specified one as an attribute of the <table> tag.

Header 1Header 2
Row 1, Cell 1Row 1, Cell 2
Row 2, Cell 1Row 2, Cell 2

In this example I aligned the second row right. Note by default you get left alignment.

Header 1Header 2
Just putting some text in hereAdding more text in this cell
Align This Row RightAlign This Row Right
No row alignmentNo row alignment

In this example I aligned the second row so that text aligns to the bottom. But to make it work I had to specify a default table height of 200 pixels. We'll learn about this in another class. Note that by default vertical alignment is in the middle. In the third row I specified a background color of pink. Rows or individual cells can be given background colors.

Header 1Header 2
Line 1
Line 2
Line 1
Line 2
Line 1
Line 2
Line 1
Line 2
Line 1
Line 2
Line 1
Line 2

In this example I placed a caption on the table. Note that the caption doesn't come across particularly well. In most cases to give a better presentation you would prefer to use other tags instead, or to use the caption in combination with other tags.

Table Caption
Header 1Header 2
Line 1
Line 2
Line 1
Line 2
Line 1
Line 2
Line 1
Line 2
Line 1
Line 2
Line 1
Line 2

Valid XHTML 1.0!