| Tables - alignment |
|
basics expanding sizing colors borders < alignment > nesting navbar quick recap tags epilogue |
The position of
cell contents can be controlled with several alignment attributes. In the
table cells below you see the alignment defaults to left, like a normal
(web) page. Vertically the table behaves differently, it defaults to the
middle of the cell. If one cell content is higher than another, the lower
will shift downwards.
<TABLE BORDER="1" WIDTH="400">
The horizontal alignment is set with the ALIGN attribute of the TD tag. Left alignment is not really necessary, since it is the default. This attribute is used for centering the navigation bar on this page.
<TABLE BORDER="1" WIDTH="400">
The vertical position of the cell contents is set quite similar, with the VALIGN attribute, short for Vertical ALIGNment. Middle is not really necessary, since it is the default. It may be wise to always set the vertical alignment to top. Just to prevent surprises when your cell content changes.
<TABLE BORDER="1" WIDTH="400">
The menu in the navigation bar at the left of this page is pushed to the top of the page with the VALIGN attribute. On some pages the menu may be larger than the text on the page. To prevent problems, I always set the vertical alignment of the text cell set to top too. |