HTML Lessons  

  1. HTML Introduction

  2. HTML Tags

  3. HTML Page Structure

  4. HTML Backgrounds

  5. HTML Formatting Text

  6. HTML Formatting Fonts

  7. HTML Headings

  8. HTML Entities

  9. HTML Line Breaks

  10. HTML Lists

  11. HTML HR- Horizontal Rule

  12. HTML Images

  13. HTML Links

  14. Table Introduction

  15. Table Rows & Columns

  16. Table Width

  17. Table Alignment

  18. Table Border Color

  19. Table Background Color

  20. Table Background Image

  21. Cell Alignment

  22. Cell Padding

  23. Cell Spacing

  24. Cell Spanning

 

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>

 

Text1

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>

Text1

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>

Text1

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>

Text1

<body>
<table width="100" height="100" border="1">
<tr>
<td valign="bottom" >Text1 </td>
</tr>
</table>
</body>

Text1

<body>
<table width="100" height="100" border="1">
<tr>
<td valign="middle" >Text1 </td>
</tr>
</table>
</body>

Text1

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.

Next Lesson

© Copyright Studio6000 2006. All rights Reserved.