Last Updated on August 5, 2019 by Roshan Parihar
Definition: The tbody tag align attribute is used to align the main content of the table in horizontal direction.
Syntax:
1 |
<tbody align="specify the value here">...</tbody> |
List of expected values of tbody tag align attribute
Sr. No. | value | Description |
---|---|---|
1 | left | left aign the main content of table. |
2 | right | right aign the main content of table. |
3 | center | center aign the main content of table. |
4 | justify | justify the main content of table. |
5 | char | aign the main content to a specific character. |
use attribute value align=”left” in tbody
Left align the main content using align=”left” in tbody part of the table.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<p>Keyboard shortcuts:</p> <table border="1"> <tr> <th>Sr. No.</th> <th>name</th> </tr> <tbody align="left"> <tr> <td>1</td> <td>Ctrl+S: To save the file.</td> </tr> <tr> <td>2</td> <td>Ctrl+V: To save the content.</td> </tr> <tr> <td>3</td> <td>Ctrl+C: To copy the content.</td> </tr> </tbody> </table> |
Output
Keyboard shortcuts:
Sr. No. | name |
---|---|
1 | Ctrl+S: To save the file. |
2 | Ctrl+V: To save the content. |
3 | Ctrl+C: To copy the content. |
use attribute value align=”right” in tbody
Right align the main content using align=”right” in tbody part of the table.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<p>Computer network terms:</p> <table> <tr> <th>Sr. No.</th> <th>name</th> </tr> <tbody align="right"> <tr> <td>1</td> <td>Local Area Network</td> </tr> <tr> <td>2</td> <td>Wide Area Network</td> </tr> <tr> <td>3</td> <td>Cisco Certified Network Association</td> </tr> </tbody> </table> |
Output
Computer network terms:
Sr. No. | name |
---|---|
1 | Local Area Network |
2 | Wide Area Network |
3 | Cisco Certified Network Association |
use attribute value align=”center” in tbody
Center align the main content using align=”center” in tbody part of the table.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<p>Computer hardware devices:</p> <table> <tr> <th>Sr. No.</th> <th>name</th> </tr> <tbody align="center"> <tr> <td>1</td> <td>Monitor</td> </tr> <tr> <td>2</td> <td>Keyboard</td> </tr> <tr> <td>3</td> <td>Printer</td> </tr> </tbody> </table> |
Output
Computer hardware devices:
Sr. No. | name |
---|---|
1 | Monitor |
2 | Keyboard |
3 | Printer |
use attribute value align=”justify” in tbody
Justify the main content using align=”justify” in tbody part of the table.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<p>Shoes branded companies:</p> <table> <tr> <th>Sr. No.</th> <th>name</th> </tr> <tbody align="justify"> <tr> <td>1</td> <td>Reebok</td> </tr> <tr> <td>2</td> <td>Red & Chief</td> </tr> <tr> <td>3</td> <td>Woodland</td> </tr> </tbody> </table> |
Output
Shoes branded companies:
Sr. No. | name |
---|---|
1 | Reebok |
2 | Red & Chief |
3 | Woodland |
use attribute value align=”char” in tbody
Align the main content to a specific character using align=”justify” in tbody part of the table.
Note: char attribute is not supported with any major browsers.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<p>Best Indian Cities:</p> <table> <tr> <th>Sr. No.</th> <th>name</th> </tr> <tbody align="char" char="+"> <tr> <td>1</td> <td>Delhi</td> </tr> <tr> <td>2</td> <td>Mumbai</td> </tr> <tr> <td>3</td> <td>Chennai</td> </tr> </tbody> </table> |
Output
Best Indian Cities:
Sr. No. | name |
---|---|
1 | Delhi |
2 | Mumbai |
3 | Chennai |