HTML | <colgroup> align Attribute
The HTML <colgroup> align attribute is used to set the horizontal alignment of the text or content in the group of column.
Syntax:
<colgroup align="left|right|center|justify|char>
Attribute Values:
- left: It sets the content to the left-align.
- right: It sets the content to the right-align.
- center: It sets the content to the center.
- justify: It stretches the lines and divided the content equally.
- char: It sets the content to a specific charaxter.
Example:
<!DOCTYPE html> <html> <head> <title> HTML ColumnGroup align Attribute </title> <style> #myColGroup { background: green; } table { color: white; margin-left: 180px; background: yellow; } #Geek_p { color: green; font-size: 30px; } td { padding: 10px; } h1, h2 { text-align:center; } </style> </head> <body> <h1 style="color:green;"> GeeksForGeeks </h1> <h2> HTML ColumnGroup align Attribute </h2> <table> <colgroup id="myColGroup" span="3" align = "left"> </colgroup> <tr> <th>S.No</th> <th>Title</th> <th>Geek_id</th> </tr> <tr> <td>Geek_1</td> <td>GeekForGeeks</td> <th>Geek_id_1</th> </tr> <tr> <td>Geek_2</td> <td>GeeksForGeeks</td> <th>Geek_id_2</th> </tr> </table> </body> </html> |
Output:
Supported Browsers: The <colgroup> align attribute is not supported by any browsers. Now use CSS instead.


