Aligning the text within a cell
You can control where the text within a cell will appear horizontally and
vertically.
By default the text in a cell will be aligned left. Meaning, if you
do not specify how to align it it will automatically be aligned left, like so:
<body> <table width="100" height="100" border="1"> <tr> <td>Text1 </td> </tr> </table> </body>
To align the text right simply insert the align attribute within the opening
cell tag (<td>), like so:
<body> <table width="100"
height="100" border="1"> <tr> <td align="right">Text1 </td> </tr> </table> </body>
To center the text simply insert align="center"
within the opening cell tag (<td>), like so:
<body> <table width="100"
height="100" border="1"> <tr> <td align="center" >Text1 </td> </tr> </table> </body>
To align the text vertically we use a similar attribute.
<body> <table width="100"
height="100" border="1"> <tr> <td valign="top" >Text1 </td> </tr> </table> </body>
<body> <table width="100"
height="100" border="1"> <tr> <td valign="bottom" >Text1 </td> </tr> </table> </body>
<body> <table width="100"
height="100" border="1"> <tr> <td valign="middle" >Text1 </td> </tr> </table> </body>
By default the text will be vertically aligned in the middle. Meaning, if you insert the attribute valign="middle" it is the equivalent of inserting nothing.
|