HTMLforall

  HTML | PHP | Forum

HTML <colgroup> tag

Syntax

<colgroup> - </colgroup>

Definition and Usage

The COLGROUP element creates a column group, a structural division within a table that can be appointed attributes with style sheets or HTML. A table may inlude more than one column group.

If used, COLGROUP must be after the optional CAPTION and before the optional THEAD in the TABLE. The structural divisions defined by COLGROUP allow authors to easily suggest a presentation for groups of columns through style sheets.

Optional Attributes

Attribute Value Description
align right
left
center
justify
char
Defines the horizontal alignment of the contents in the column group
char character Defines a character to use to align text on (use with align="char")
charoff pixels
%
Defines an alignment offset to the first character to align on, as set with char
span number Defines the number of columns the <colgroup> should span
valign top
middle
bottom
baseline
Defines the vertical alignment of the contents in the column group
width %
pixels
relative_length
Defines the width of the column group.

Note: The width attribute can be overridden by settings in <col>

Standard Attributes

id, class, title, style, dir, lang, xml:lang

For a full description, go to Standard Attributes.

Event Attributes

onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup

For a full description, go to Event Attributes.

Example

Source Output
This example shows a table that uses <colgroup>:
<table border="2">
<colgroup span="4">
</colgroup>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
</table>
This example shows a table that uses colgroup:
1 2 3 4

Home

Learn HTML
HTML Tutorial

HTML Reference
HTML by function
HTML by Alphabet

HTML events
HTML attributes
HTML color names

Top-Level Elements
<!--...-->
<!DOCTYPE> 
<html>
<head>
<body>
<frameset>
Head Elements
<base>
<isindex>
<link>
<meta>
<script>
<style>
<title>
Generic Block-level Elements
<address>
<blockquote>
<center>
<del>
<div>
<h1> to <h6>
<hr>
<ins>
<isindex>
<noscript>
<p>
<pre>
Lists
<dd>
<dir>
<dl>
<dt>
<li>
<menu>
<ol>
<ul>
Tables
<caption>
<col>
<colgroup>
<table>
<tbody>
<td>
<tfoot>
<th>
<thead>
<tr>
Forms
<button>
<fieldset>
<form>
<input>
<label>
<legend>
<option>
<optgroup>
<select>
<textarea>
Special Inline Elements
<a>
<applet>
<area>
<basefont>
<bdo>
<br>
<font>
<iframe>
<img>
<map>
<object>
<param>
<q>
<script>
<span>
<sub>
<sup>
Phrase Elements
<abbr>
<acronym>
<cite>
<code>
<del>
<dfn>
<em>
<ins>
<kbd>
<samp>
<strong>
<var>
Font Style Elements
<b>
<big>
<i>
<s>
<small>
<strike>
<tt>
<u>
Frames
<frame>
<frameset>
<noframes>

 

Copyright 2005-8 Sunilcare.  All Rights Reserved.
Comments or suggestions? Contact us.About us