English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
This article introduces the usage of the HTML col span attribute, online examples demonstrate how to use the HTML col span attribute, browser compatibility, syntax definition, and detailed information about its attribute values. The span attribute defines the number of columns that the <col> element should span.
Here, the background color of the first two columns is blue:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>HTML <col> span Attribute Usage-基础教程(oldtoolbag.com)</title> <style>table, th, td { border: 1px solid black;</style> </head> <body> <table> <colgroup> <col span="2" style="background-color:blue"> <col style="background-color:pink"> </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 it out ‹/›
IEFirefoxOperaChromeSafari
All major browsers support the span attribute.
The span attribute specifies the number of columns that the col element should span.
NONE.
<col span="number">
Value | Description |
---|---|
number | Set the number of columns that the col element should span. |