Table Alignment

HTML tables can be aligned on the page, and cell content can be aligned within the cell. Both cases, the whole table and individual cells use the same attribute. This attribute is ALIGN.

To align a table on the page use the follow syntax within the <TABLE> tag:

<TABLE ALIGN="alignment">
Where alignment can be one of the following options:

Aligns to the leftmost edge of the window. Aligns to the left text margin. Aligns to the center of the window. Adjusts the table size to align to both text margins. Aligns to the right text margin. Aligns to the rightmost edge of the window.

To align the information within the cell use the ALIGN attribute within the <TD> marker or within the <TH> marker. Remember, the default alignment of the information in the header cell is CENTER, while the default alignment of a data cell is LEFT. So, the ALIGN attribute is optional. However, it was used in the table shown above to align the header and data cells.

I understand table and cell alignment. How do I add a border around my table?


Valid HTML 3.2!