System.Web.UI.HtmlControls Namespace HtmlTableCell Class
Sets or retrieves the horizontal alignment of content within an HtmlTableCell control.
Inline |
<th | td align = 'left' | 'center' | 'right' ... > |
Script |
HtmlTableCell.Align [ = 'left' | 'center' | 'right' ] |
A string specifying the horizontal position of content within the table cell.
The following table lists the values that can be used for this property.
Value |
Description |
left |
Aligns the contents with the left edge of the cell. |
center |
Aligns the contents in the horizontal middle of the cell. |
right |
Aligns the contents with the right edge of the cell. |
The property is read/write with a default value of left.
Use the Align property to specify the horizontal position of the content in an HtmlTableCell class.
Setting this property affects only the individual cell. To apply the same alignment to the cells of an entire row in the table, set the Align property of the HtmlTableRow.
To apply the same horizontal alignment to all cells of an entire table, you can loop thru each cell in each row using the Cells and Rows collection.
The below snippet shows how to declaratively set the Align property of a table cell at design time.
<table cellspacing=1 width="92%" runat="server">
<tr>
<th>Table header</th></tr>
<tr>
<td align="center">Table data</td></tr>
</table>
The following example demonstrates how to programmatically set the horizontal alignment of the contents of each cell in an HtmlTable control.
Show me
HtmlTableCell Members VAlign