The HTML <col>
ingredient defines a column inside a desk, and is commonly utilized in mixture with the <colgroup>
ingredient. It’s used to use properties to all cells in a selected column of a desk.
Syntax
1 |
<col attribute1="value1" attribute2="value2"...> |
Instance
This instance exhibits the utilization of the <col>
ingredient inside a desk.
1 |
<desk>
|
2 |
<colgroup>
|
3 |
<col model="width: 300px"> |
4 |
<col>
|
5 |
<col>
|
6 |
</colgroup>
|
7 |
<thead>
|
8 |
<tr>
|
9 |
<th>Product Title</th> |
10 |
<th>Description</th> |
11 |
<th>Worth</th> |
12 |
</tr>
|
13 |
</thead>
|
14 |
<tbody>
|
15 |
<tr>
|
16 |
<td>Product 1</td> |
17 |
<td>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam euismod, nunc quis bibendum varius, metus urna hendrerit augue, id congue purus odio id lectus.</td> |
18 |
<td>$9.99</td> |
19 |
</tr>
|
20 |
<tr>
|
21 |
<td>Product 2</td> |
22 |
<td>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam euismod, nunc quis bibendum varius, metus urna hendrerit augue, id congue purus odio id lectus.</td> |
23 |
<td>$14.99</td> |
24 |
</tr>
|
25 |
<tr>
|
26 |
<td>Product 3</td> |
27 |
<td>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam euismod, nunc quis bibendum varius, metus urna hendrerit augue, id congue purus odio id lectus.</td> |
28 |
<td>$19.99</td> |
29 |
</tr>
|
30 |
</tbody>
|
31 |
</desk>
|
Consequence
Discover how the primary column within the desk is at all times 300px vast, regardless of how vast the desk is. Verify the full web page demo to see extra clearly.
Attributes
The <col>
tag helps World Attributes in HTML. World Attributes are widespread to all HTML parts and can be utilized on all of them (although they could not have a lot of an impact on a few of them).
The <col>
ingredient has the next attributes:
-
span
: specifies the variety of columns a<col>
ingredient ought to span.
Content material
The <col>
ingredient doesn’t settle for any content material.
Tables and tabular information are massively essential for internet pages. HTML provides us a lot of parts for structuring tables.