HTML Home
HTML Tags Reference
Selected Reading
© 2011 TutorialsPoint.COM
|
HTML <col> tag
Function:
The HTML <col> tag allows authors to group together attribute specifications for table columns. The <col> does not group columns together structurally -- that is the role of the <colgroup> element.
The <col> elements are empty and serve only as a support for attributes.
Difference between HTML and XHTML:
In HTML the <col> tag has no end tag.
In XHTML the <col> tag must be properly closed.
Example:
<p>This example shows a colgroup that has three columns of different widths:</p>
<table border="1">
<colgroup span="3">
<col width="50"></col>
<col width="100"></col>
<col width="200"></col>
</colgroup>
<tr>
<td>col 1</td>
<td>col 2</td>
<td>col 3</td>
</tr>
</table>
|
This will produce following result:
This example shows a colgroup that has three columns of different widths:
|
Online Practice:
To Become more comfortable - Do Online Practice
Attributes:
Attribute | Value | Description |
align | right left center justify char | Defines horizontal alignment |
char | character | Defines a character to use to align text on (use with align="char"). |
charoff | pixel | Specifies an alignment offset (either in pixels or percentage value) against the first character as specified with the char attribute. |
span | number | Defines the number of columns the <col> should span |
valign | bottom middle top baseline | Defines vertical alignment |
width | pixels or % | Specifies a default width for each column spanned by the current col element |
Standard Attributes:
Attribute | Description |
class | Document wide identifier |
dir | Specifies the direction of the text |
id | Document wide identifier |
title | Specifies a title to associate with the element. |
style | Helps to include inline casecadubf style sheet. |
lang | Sets the language code. |
Event Attributes:
Attribute | Description |
onclick | Script runs when a mouse click |
ondblclick | Script runs when a mouse double-click |
onmousedown | Script runs when mouse button is pressed |
onmouseup | Script runs when mouse button is released |
onmouseover | Script runs when mouse pointer moves over an element |
onmousemove | Script runs when mouse pointer moves |
onmouseout | Script runs when mouse pointer moves out of an element |
onkeypress | Script runs when key is pressed and released |
onkeydown | Script runs when key is pressed |
onkeyup | Script runs when key is released |
|
|
|