|
You can control not just the alignment of the table but of contents of the cells in the table. By default, Internet Explorer aligns the text in a <th> tag in the centre and the content in a <td> cell aligns to the left edge of each cell. Use the align and valign attributes in the <th>, <tr> or <td> tags to tell the browser how to align the content of cells. The align attribute can take one of these values: left, center and right. It works like this:
You can also add the align attribute to a row to set the alignment for every cell in the row but you cannot apply it to the <table> tag to change the alignment of every cell in the table. If you set the align attribute for the table, this controls the alignment of the table with the surrounding text. See Aligning a table on the page for more details. The valign attribute takes one of four values: top, center, bottom and baseline. The large text in the first column is just so you can see what happens. It works like this:
The baseline of a font is the imaginary line on which letters rest. If you align to the baseline, the browser finds the lowest baseline of all the cells in the row and aligns all the text to that baseline. You can also add the valign attribute to a row to set the vertical alignment for every cell in the row and you can apply it to the <table> tag to change the vertical alignment of every cell in the table. |
More information Adding a background picture to a table Aligning cells in table |