HTML - <colgroup>
The HTML Table Column Group Element (<colgroup>) defines a group of columns within a table.
Example
Please see the <table>
page for examples on <colgroup>
.
Description
The HTML Table Column Group Element (<colgroup>) defines a group of columns within a table.
Content categories | None. |
---|---|
Permitted content | If the span attribute is present: none, it is an empty element.If the attribute is not present: zero or more <col> element |
Tag omission | The start tag may be omitted, if it has a <col> element as its first child and if it is not preceded by a <colgroup> whose end tag has been omitted.The end tag may be omitted, if it is not followed by a space or a comment. |
Permitted parent elements | A <table> element. The <colgroup> must appear after any optional <caption> element but before any <thead> , <th> , <tbody> , <tfoot> and <tr> element. |
DOM interface | HTMLTableColElement |
Browser Compatibility
See Also
- Other table-related HTML Elements:
<caption>
,<col>
,<table>
,<tbody>
,<td>
,<tfoot>
,<th>
,<thead>
,<tr>
; - CSS properties and pseudo-classes that may be specially useful to style the
<col>
element:- the
width
property to control the width of the column; - the
:nth-child
pseudo-class to set the alignment on the cells of the column; - the
text-align
property to align all cells content on the same character, like '.'.
- the
Specifications
Specification | Status | Comment |
---|---|---|
WHATWG HTML Living Standard The definition of '<colgroup>' in that specification. |
Living Standard | |
HTML5 The definition of '<colgroup>' in that specification. |
Recommendation | |
HTML 4.01 Specification The definition of '<colgroup>' in that specification. |
Recommendation |
License
© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/html/element/colgroup