HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
The span attribute defines the number of columns a <col> or <colgroup> element should span."
The span
attribute defines the number of columns a
<col>
or <colgroup>
element should span.
The span
attribute can be used on the following elements:
Elements | Attribute |
---|---|
<col> | span |
<colgroup> | span |
Here, the first two columns should have a background color of red:
<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>
</table>
Set the background color of the first two columns using the <colgroup> span attribute:
<table>
<colgroup span="2" style="background:red"></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>
The span
attribute has the following browser support for each element:
Element | |||||
---|---|---|---|---|---|
col | Yes | Yes | Yes | Yes | Yes |
colgroup | Yes | Yes | Yes | Yes | Yes |