HTML | <caption> align Attribute
The HTML <caption> align Attribute is used to specify the alignment of the <caption> Element. It is used to align the caption to the left, right, top and Bottom of a table.
This attribute is not supported in HTML5.
Syntax:
<caption align="left | right | top | bottom>
Attribute Values
- left: It sets the left-align caption of the table.
- right: It sets the right-align caption of the Table
- Top: It sets the top-align caption of the table.
- Bottom: It sets the bottom-align caption of the table.
Example:
<!-- HTML code to show the working of caption tag --><!DOCTYPE html> <html> <head> <style> table, th, td { border: 1px solid black; } #GFG { font-size: 25px; color: green; } </style> </head> <body> <h1 style="color:green;font-size:35px;"> GeeksForGeeks </h1> <h2>HTML Caption align Attribute</h2> <table> <!-- Adding caption to the table --> <caption id="GFG" align="top"> Students </caption> <tr> <th>Firstname</th> <th>Lastname</th> <th>Age</th> </tr> <tr> <td>Priya</td> <td>Sharma</td> <td>24</td> </tr> <tr> <td>Arun</td> <td>Singh</td> <td>32</td> </tr> <tr> <td>Sam</td> <td>Watson</td> <td>41</td> </tr> </table> <br> <br> <table> <!-- Adding caption to the table --> <caption id="GFG" align="bottom"> Students </caption> <tr> <th>Firstname</th> <th>Lastname</th> <th>Age</th> </tr> <tr> <td>Priya</td> <td>Sharma</td> <td>24</td> </tr> <tr> <td>Arun</td> <td>Singh</td> <td>32</td> </tr> <tr> <td>Sam</td> <td>Watson</td> <td>41</td> </tr> </table> </body> </html> |
chevron_right
filter_none
Output :

Supported Browsers: The browsers supported by HTML <caption> align Attribute are listed below:
- Google Chrome
- Internet Explorer
- Firefox
- Apple Safari
- Opera
Recommended Posts:
- HTML | <col> align Attribute
- HTML | <td> align Attribute
- HTML | <hr> align Attribute
- HTML | <th> align Attribute
- HTML | <img> align Attribute
- HTML | <tr> align Attribute
- HTML | <p> align Attribute
- HTML | <div> align Attribute
- HTML | <colgroup> align Attribute
- HTML | <input> align Attribute
- HTML | <object> align Attribute
- HTML | <legend> align Attribute
- HTML | <tfoot> align Attribute
- HTML <table> align Attribute
- HTML | <tbody> align Attribute
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



