English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML Tag Directory

HTML table align attribute

The table align attribute specifies the alignment of the table based on the surrounding text; usually, there is a break before and after the HTML table. The align attribute allows other HTML elements to wrap around the table.

 HTML <table> tag

Online Example

A right-aligned HTML table:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML table align attribute usage-Basic Tutorial(oldtoolbag.com)</title>
<style>table, th, td { border: 1px solid black;</style>
</head>
<body>
<table align="right">
  <tr>
    <th>Name</th>
    <th>Credits</th>
  </tr>
  <tr>
    <td>Zhang San</td>
    <td>90</td>
  </tr>
  <tr>
    <td>Li Si</td>
    <td>87</td>
  </tr>
</table>
<p>The align attribute allows text to wrap around the table.</p>
</body>
</html>
Test and see ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the align attribute.

Definition and Usage

HTML5 The <table> align attribute is not supported. Please use CSS instead.

In HTML 4.01 In the example, the align attribute of <table> is deprecated.

 The table align attribute specifies the alignment of the table based on the surrounding text.

Typically, HTML tables have a break before and after them. The align attribute allows other HTML elements to wrap around the table.

Compatibility Notes

In HTML 4.01 In the example, the align attribute of <table> is deprecated, please use CSS instead.

CSS Syntax: <table style="float:right">

CSS Example: Table Alignment

In our CSS tutorial, you can find more aboutfloat attribute details.

Syntax

<table align="left|right|center">

Attribute value

ValueDescription
leftLeft aligned table.
rightRight aligned table.
centerCenter aligned table.
 HTML <table> tag