Align the content of a table cell
Description:
How to align the content of a table cell.
Code:
<html>
<body>
<h4>Table align</h4>
<table width="300" border="3">
<tr>
<th align="left">Cell 1</th>
<th align="center">Cell 2</th>
<th align="right">Cell 3</th>
</tr>
<tr>
<td align="left">Cell 4</td>
<td align="center">Cell 5</td>
<td align="right">Cell 6</td>
</tr>
<tr>
<td align="left">Cell 7</td>
<td align="center">Cell 8</td>
<td align="right">Cell 9</td>
</tr>
</table>
</body>
<html>
Play with the code:
See working example:
Explanation:
To align the content of a table's cell, use the property align of the <td> tag and set its value to left, center or right.
You also can change table's size with the attribute width in the <table> tag.
See Also:
HTML: Html, Body, Table, Tr, Td, Th
|