HTML/Elements/colgroup

From Web Education Community Group
< HTML‎ | Elements
Revision as of 13:20, 19 November 2011 by Rworth (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

<colgroup>

The <colgroup> element represents a group of one or more columns in the table that is its parent.

Point

  • As a child of a table element, after any caption elements and before any thead, tbody, tfoot, and tr elements.
  • If the colgroup element contains no col elements, then the element may have a span content attribute specified. [Example A]

HTML Attributes

  • span = valid non-negative integer


See also global attributes.


Examples

Example A

[try it]:

<table>
  <colgroup span="2" style="background-color: #ff0000;"></colgroup>
  <tr>
    <td>1</td>
    <td>2</td>
    <td>3</td>
  </tr>
  <tr>
    <td>4</td>
    <td>5</td>
    <td>6</td>
  </tr>  
</table>

HTML Reference

The HTML5 specification defines the <colgroup> element in 4.9.3 The colgroup element.