summaryrefslogtreecommitdiff
path: root/devdocs/html/element%2Fcolgroup.html
diff options
context:
space:
mode:
Diffstat (limited to 'devdocs/html/element%2Fcolgroup.html')
-rw-r--r--devdocs/html/element%2Fcolgroup.html192
1 files changed, 192 insertions, 0 deletions
diff --git a/devdocs/html/element%2Fcolgroup.html b/devdocs/html/element%2Fcolgroup.html
new file mode 100644
index 00000000..59269436
--- /dev/null
+++ b/devdocs/html/element%2Fcolgroup.html
@@ -0,0 +1,192 @@
+<header><h1>&lt;colgroup&gt;: The Table Column Group element</h1></header><div class="section-content"><p>The <code>&lt;colgroup&gt;</code> <a href="../index">HTML</a> element defines a group of columns within a table.</p></div>
+<h2 id="try_it">Try it</h2>
+<div class="section-content"><iframe class="interactive is-tabbed-taller-height" height="200" src="https://interactive-examples.mdn.mozilla.net/pages/tabbed/colgroup.html" title="MDN Web Docs Interactive Example" loading="lazy"></iframe></div>
+<h2 id="attributes">Attributes</h2>
+<div class="section-content">
+<p>This element's attributes include the <a href="../global_attributes">global attributes</a>.</p> <dl> <dt id="span"><a href="#span"><code>span</code></a></dt> <dd> <p>This attribute contains a positive integer indicating the number of consecutive columns the <code>&lt;colgroup&gt;</code> element spans. If not present, its default value is <code>1</code>.</p> <p>The <code>span</code> attribute is not permitted if there are one or more <a href="col"><code>&lt;col&gt;</code></a> elements within the <code>&lt;colgroup&gt;</code>.</p> </dd> </dl>
+</div>
+<h3 id="deprecated_attributes">Deprecated attributes</h3>
+<div class="section-content">
+<p>The following attributes are deprecated and should not be used. They are documented below for reference when updating existing code and for historical interest only.</p> <dl> <dt id="align">
+<a href="#align"><code>align</code></a> <abbr class="icon icon-deprecated" title="Deprecated. Not for use in new websites."> <span class="visually-hidden">Deprecated</span> </abbr>
+</dt> <dd> <p>This <a href="https://developer.mozilla.org/en-US/docs/Glossary/Enumerated">enumerated</a> attribute specifies how horizontal alignment of each column cell content will be handled. Possible values are:</p> <ul> <li>
+<code>left</code>, aligning the content to the left of the cell</li> <li>
+<code>center</code>, centering the content in the cell</li> <li>
+<code>right</code>, aligning the content to the right of the cell</li> <li>
+<code>justify</code>, inserting spaces into the textual content so that the content is justified in the cell</li> <li>
+<code>char</code>, aligning the textual content on a special character with a minimal offset, defined by the <a href="col#char"><code>char</code></a> and <a href="col#charoff"><code>charoff</code></a> attributes.</li> </ul> <p>If this attribute is not set, the <code>left</code> value is assumed. The descendant <a href="col"><code>&lt;col&gt;</code></a> elements may override this value using their own <a href="col#align"><code>align</code></a> attribute.</p> <div class="notecard note" id="sect1"> <p><strong>Note:</strong> Do not try to set the <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/text-align"><code>text-align</code></a> property on a selector giving a <a href="colgroup" aria-current="page"><code>&lt;colgroup&gt;</code></a> element. Because <a href="td"><code>&lt;td&gt;</code></a> elements are not descendant of the <a href="colgroup" aria-current="page"><code>&lt;colgroup&gt;</code></a> element, they won't inherit it.</p> <p>If the table doesn't use a <a href="td#colspan"><code>colspan</code></a> attribute, use one <code>td:nth-child(an+b)</code> CSS selector per column, where 'a' is the total number of the columns in the table and 'b' is the ordinal position of this column in the table. Only after this selector the <code>text-align</code> property can be used.</p> <p>If the table does use a <a href="td#colspan"><code>colspan</code></a> attribute, the effect can be achieved by combining adequate CSS attribute selectors like <code>[colspan=n]</code>, though this is not trivial.</p> </div> </dd> <dt id="bgcolor">
+<a href="#bgcolor"><code>bgcolor</code></a> <abbr class="icon icon-deprecated" title="Deprecated. Not for use in new websites."> <span class="visually-hidden">Deprecated</span> </abbr>
+</dt> <dd> <p>The background color of the table. It is a <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/hex-color">6-digit hexadecimal RGB code</a>, prefixed by a '<code>#</code>'. One of the predefined <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/named-color">color keywords</a> can also be used.</p> <p>To achieve a similar effect, use the CSS <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/background-color"><code>background-color</code></a> property.</p> </dd> <dt id="char">
+<a href="#char"><code>char</code></a> <abbr class="icon icon-deprecated" title="Deprecated. Not for use in new websites."> <span class="visually-hidden">Deprecated</span> </abbr>
+</dt> <dd> <p>This attribute specifies the alignment of the content in a column group to a character. Typical values for this include a period (.) when attempting to align numbers or monetary values. If <a href="#align"><code>align</code></a> is not set to <code>char</code>, this attribute is ignored, though it will still be used as the default value for the <a href="col#align"><code>align</code></a> of the <a href="col"><code>&lt;col&gt;</code></a> which are members of this column group.</p> </dd> <dt id="charoff">
+<a href="#charoff"><code>charoff</code></a> <abbr class="icon icon-deprecated" title="Deprecated. Not for use in new websites."> <span class="visually-hidden">Deprecated</span> </abbr>
+</dt> <dd> <p>This attribute is used to indicate the number of characters to offset the column data from the alignment character specified by the <code>char</code> attribute.</p> </dd> <dt id="valign">
+<a href="#valign"><code>valign</code></a> <abbr class="icon icon-deprecated" title="Deprecated. Not for use in new websites."> <span class="visually-hidden">Deprecated</span> </abbr>
+</dt> <dd> <p>This attribute specifies the vertical alignment of the text within each cell of the column. Possible values for this attribute are:</p> <ul> <li>
+<code>baseline</code>, which will put the text as close to the bottom of the cell as it is possible, but align it on the <a href="https://en.wikipedia.org/wiki/Baseline_%28typography%29" target="_blank">baseline</a> of the characters instead of the bottom of them. If characters are all of the size, this has the same effect as <code>bottom</code>.</li> <li>
+<code>bottom</code>, which will put the text as close to the bottom of the cell as it is possible;</li> <li>
+<code>middle</code>, which will center the text in the cell;</li> <li>and <code>top</code>, which will put the text as close to the top of the cell as it is possible.</li> </ul> <div class="notecard note" id="sect2"> <p><strong>Note:</strong> Do not try to set the <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/vertical-align"><code>vertical-align</code></a> property on a selector giving a <code>&lt;colgroup&gt;</code> element. Because <a href="td"><code>&lt;td&gt;</code></a> elements are not descendant of the <code>&lt;colgroup&gt;</code> element, they won't inherit it.</p> <p>If the table doesn't use a <a href="td#colspan"><code>colspan</code></a> attribute, use the <code>td:nth-child(an+b)</code> CSS selector per column, where 'a' is the total number of the columns in the table and 'b' is the ordinal position of the column in the table. Only after this selector the <code>vertical-align</code> property can be used.</p> <p>If the table does use a <a href="td#colspan"><code>colspan</code></a> attribute, the effect can be achieved by combining adequate CSS attribute selectors like <code>[colspan=n]</code>, though this is not trivial.</p> </div> </dd> </dl>
+</div>
+<h2 id="examples">Examples</h2>
+<div class="section-content"><p>Please see the <a href="table"><code>&lt;table&gt;</code></a> page for examples on <code>&lt;colgroup&gt;</code>.</p></div>
+<h2 id="technical_summary">Technical summary</h2>
+<div class="section-content"><figure class="table-container"><div class="_table"><table class="properties"> <tbody> <tr> <th scope="row"><a href="../content_categories">Content categories</a></th> <td>None.</td> </tr> <tr> <th scope="row">Permitted content</th> <td> If the <a href="colgroup#span" aria-current="page"><code>span</code></a> attribute is present: none.<br>If the attribute is not present: zero or more <a href="col"><code>&lt;col&gt;</code></a> element </td> </tr> <tr> <th scope="row">Tag omission</th> <td> The start tag may be omitted, if it has a <a href="col"><code>&lt;col&gt;</code></a> element as its first child and if it is not preceded by a <a href="colgroup" aria-current="page"><code>&lt;colgroup&gt;</code></a> whose end tag has been omitted.<br>The end tag may be omitted, if it is not followed by a space or a comment. </td> </tr> <tr> <th scope="row">Permitted parents</th> <td> A <a href="table"><code>&lt;table&gt;</code></a> element. The <a href="colgroup" aria-current="page"><code>&lt;colgroup&gt;</code></a> must appear after any optional <a href="caption"><code>&lt;caption&gt;</code></a> element but before any <a href="thead"><code>&lt;thead&gt;</code></a>, <a href="th"><code>&lt;th&gt;</code></a>, <a href="tbody"><code>&lt;tbody&gt;</code></a>, <a href="tfoot"><code>&lt;tfoot&gt;</code></a> and <a href="tr"><code>&lt;tr&gt;</code></a> element. </td> </tr> <tr> <th scope="row">Implicit ARIA role</th> <td><a href="https://www.w3.org/TR/html-aria/#dfn-no-corresponding-role" target="_blank">No corresponding role</a></td> </tr> <tr> <th scope="row">Permitted ARIA roles</th> <td>No <code>role</code> permitted</td> </tr> <tr> <th scope="row">DOM interface</th> <td><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableColElement"><code>HTMLTableColElement</code></a></td> </tr> </tbody> </table></div></figure></div>
+<h2 id="specifications">Specifications</h2>
+<div class="_table"><table class="standard-table">
+<thead><tr><th scope="col">Specification</th></tr></thead>
+<tbody><tr><td><a href="https://html.spec.whatwg.org/multipage/tables.html#the-colgroup-element">HTML Standard <br><small># the-colgroup-element</small></a></td></tr></tbody>
+</table></div>
+<h2 id="browser_compatibility">Browser compatibility</h2>
+<div class="_table"><table>
+<thead>
+<tr id="bct-browser-type">
+<th></th>
+<th colspan="6">Desktop</th>
+<th colspan="6">Mobile</th>
+</tr>
+<tr id="bct-browsers">
+<th></th>
+<th>Chrome</th>
+<th>Edge</th>
+<th>Firefox</th>
+<th>Internet Explorer</th>
+<th>Opera</th>
+<th>Safari</th>
+<th>WebView Android</th>
+<th>Chrome Android</th>
+<th>Firefox for Android</th>
+<th>Opera Android</th>
+<th>Safari on IOS</th>
+<th>Samsung Internet</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<th><code>colgroup</code></th>
+<td class="bc-supports-yes">1</td>
+<td class="bc-supports-yes">12</td>
+<td class="bc-supports-yes">1</td>
+<td class="bc-supports-yes">Yes</td>
+<td class="bc-supports-yes">15</td>
+<td class="bc-supports-yes">≤4</td>
+<td class="bc-supports-yes">4.4</td>
+<td class="bc-supports-yes">18</td>
+<td class="bc-supports-yes">4</td>
+<td class="bc-supports-yes">14</td>
+<td class="bc-supports-yes">≤3.2</td>
+<td class="bc-supports-yes">1.0</td>
+</tr>
+<tr>
+<th><code>align</code></th>
+<td class="bc-supports-yes">1</td>
+<td class="bc-supports-yes">12</td>
+<td class="bc-supports-yes">1</td>
+<td class="bc-supports-yes">Yes</td>
+<td class="bc-supports-yes">15</td>
+<td class="bc-supports-yes">3</td>
+<td class="bc-supports-yes">4.4</td>
+<td class="bc-supports-yes">18</td>
+<td class="bc-supports-yes">4</td>
+<td class="bc-supports-yes">14</td>
+<td class="bc-supports-yes">2</td>
+<td class="bc-supports-yes">1.0</td>
+</tr>
+<tr>
+<th><code>bgcolor</code></th>
+<td class="bc-supports-yes">1</td>
+<td class="bc-supports-yes">12</td>
+<td class="bc-supports-yes">1</td>
+<td class="bc-supports-yes">Yes</td>
+<td class="bc-supports-yes">15</td>
+<td class="bc-supports-yes">1</td>
+<td class="bc-supports-yes">4.4</td>
+<td class="bc-supports-yes">18</td>
+<td class="bc-supports-yes">4</td>
+<td class="bc-supports-yes">14</td>
+<td class="bc-supports-yes">1</td>
+<td class="bc-supports-yes">1.0</td>
+</tr>
+<tr>
+<th><code>char</code></th>
+<td class="bc-supports-yes">1</td>
+<td class="bc-supports-yes">12</td>
+<td class="bc-supports-no">No</td>
+<td class="bc-supports-yes">Yes</td>
+<td class="bc-supports-yes">15</td>
+<td class="bc-supports-yes">3</td>
+<td class="bc-supports-yes">4.4</td>
+<td class="bc-supports-yes">18</td>
+<td class="bc-supports-no">No</td>
+<td class="bc-supports-yes">14</td>
+<td class="bc-supports-yes">2</td>
+<td class="bc-supports-yes">1.0</td>
+</tr>
+<tr>
+<th><code>charoff</code></th>
+<td class="bc-supports-yes">1</td>
+<td class="bc-supports-yes">12</td>
+<td class="bc-supports-no">No</td>
+<td class="bc-supports-yes">Yes</td>
+<td class="bc-supports-yes">15</td>
+<td class="bc-supports-yes">3</td>
+<td class="bc-supports-yes">4.4</td>
+<td class="bc-supports-yes">18</td>
+<td class="bc-supports-no">No</td>
+<td class="bc-supports-yes">14</td>
+<td class="bc-supports-yes">2</td>
+<td class="bc-supports-yes">1.0</td>
+</tr>
+<tr>
+<th><code>span</code></th>
+<td class="bc-supports-yes">1</td>
+<td class="bc-supports-yes">12</td>
+<td class="bc-supports-yes">1</td>
+<td class="bc-supports-yes">Yes</td>
+<td class="bc-supports-yes">15</td>
+<td class="bc-supports-yes">≤4</td>
+<td class="bc-supports-yes">4.4</td>
+<td class="bc-supports-yes">18</td>
+<td class="bc-supports-yes">4</td>
+<td class="bc-supports-yes">14</td>
+<td class="bc-supports-yes">≤3.2</td>
+<td class="bc-supports-yes">1.0</td>
+</tr>
+<tr>
+<th><code>valign</code></th>
+<td class="bc-supports-yes">1</td>
+<td class="bc-supports-yes">12</td>
+<td class="bc-supports-yes">1</td>
+<td class="bc-supports-yes">Yes</td>
+<td class="bc-supports-yes">15</td>
+<td class="bc-supports-yes">3</td>
+<td class="bc-supports-yes">4.4</td>
+<td class="bc-supports-yes">18</td>
+<td class="bc-supports-yes">4</td>
+<td class="bc-supports-yes">14</td>
+<td class="bc-supports-yes">2</td>
+<td class="bc-supports-yes">1.0</td>
+</tr>
+<tr>
+<th><code>width</code></th>
+<td class="bc-supports-yes">1</td>
+<td class="bc-supports-yes">12</td>
+<td class="bc-supports-yes">1</td>
+<td class="bc-supports-yes">Yes</td>
+<td class="bc-supports-yes">15</td>
+<td class="bc-supports-yes">≤4</td>
+<td class="bc-supports-yes">4.4</td>
+<td class="bc-supports-yes">18</td>
+<td class="bc-supports-yes">4</td>
+<td class="bc-supports-yes">14</td>
+<td class="bc-supports-yes">≤3.2</td>
+<td class="bc-supports-yes">1.0</td>
+</tr>
+</tbody>
+</table></div>
+<h2 id="see_also">See also</h2>
+<div class="section-content"><ul> <li>CSS properties and <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes">pseudo-classes</a> that may be specially useful to style the <code>&lt;col&gt;</code> element: <ul> <li>the <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/width"><code>width</code></a> property to control the width of the column;</li> <li>the <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-child"><code>:nth-child</code></a> pseudo-class to set the alignment on the cells of the column;</li> <li>the <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/text-align"><code>text-align</code></a> property to align all cells content on the same character, like '.'.</li> </ul> </li> </ul></div><div class="_attribution">
+ <p class="_attribution-p">
+ &copy; 2005&ndash;2023 MDN contributors.<br>Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.<br>
+ <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/colgroup" class="_attribution-link">https://developer.mozilla.org/en-US/docs/Web/HTML/Element/colgroup</a>
+ </p>
+</div>