HTML Table align attribute

Example

A right-aligned HTML table:
<table border="1" align="right">
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
  <tr>
    <td>February</td>
    <td>$80</td>
  </tr>
</table>


Definition and Usage

The align attribute specifies the alignment of a table according to surrounding text.
Normally, an HTML table will have a break before and after it. The align attribute allows other HTML elements to wrap around the table.

Browser Support

The align attribute is deprecated, but still supported in all major browsers.

Compatibility Notes

The align attribute of the table element was deprecated in HTML 4.01, and is not supported in XHTML 1.0 Strict DTD.
Use CSS instead.
CSS syntax: <table style="float:right">

Syntax

<table align="value">

Attribute Values

Value Description
left Left-aligns the table
right Right-aligns the table
center Center-aligns the table
Share this article :
 
Copyright © 2012. Best Online Tutorials | Source codes | Programming Languages - All Rights Reserved