English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
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.
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 ‹/›
IEFirefoxOperaChromeSafari
All major browsers support the align attribute.
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.
In HTML 4.01 In the example, the align attribute of <table> is deprecated, please use CSS instead.
CSS Syntax: <table style="float:right">
In our CSS tutorial, you can find more aboutfloat attribute details.
<table align="left|right|center">
Value | Description |
---|---|
left | Left aligned table. |
right | Right aligned table. |
center | Center aligned table. |