English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The align attribute specifies the horizontal alignment of the content related to the col element, the <col> tag specifies column attributes for each column within the <colgroup> element, and the <col> tag is very useful for applying styles to the entire column rather than repeating styles for each cell in each row.
Use <colgroup> and <col> tags to set the background color of three columns:
<!DOCTYPE html> <html> <head> <meta charset="utf-8> <title>HTML <col> align Attribute Usage<-Basic Tutorial(oldtoolbag.com)</title> <style>table, th, td { border: 1px solid black;</style> </head> <body> <table> <colgroup> <col span="2" style="background-color:red> <col style="background-color:yellow> </colgroup> <tr> <th>ISBN</th> <th>Title</th> <th>Price</th> </tr> <tr> <td>3476896</td> <td>My first HTML</td> <td>53</td> </tr> <tr> <td>5869207</td> <td>My first CSS</td> <td>49</td> </tr> </table> </body> </html>Test to see </›
IEFirefoxOperaChromeSafari
Only Opera and Internet Explorer 8 and earlier IE versions support the align attribute (IE9This attribute is not supported).
HTML5 The <col> align attribute is not supported.
The align attribute specifies the horizontal alignment of the content related to the col element.
The <col> tag specifies column properties for each column within the <colgroup> element.
The <col> tag is very useful for applying styles to an entire column, rather than repeating the style for each cell in each row.
<col align="left|right|center|justify|char">
Value | Description |
---|---|
left | Align content to the left (the default value). |
right | Align content to the right. |
center | Align content to center (the default value of the th element). |
justify | Extend the line, so that each line can have an equal length (like in newspapers and magazines). |
char | Align content to a specified character. |