summaryrefslogtreecommitdiff
path: root/devdocs/html/element%2Fcol.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/html/element%2Fcol.html
new repository
Diffstat (limited to 'devdocs/html/element%2Fcol.html')
-rw-r--r--devdocs/html/element%2Fcol.html195
1 files changed, 195 insertions, 0 deletions
diff --git a/devdocs/html/element%2Fcol.html b/devdocs/html/element%2Fcol.html
new file mode 100644
index 00000000..a5e93c76
--- /dev/null
+++ b/devdocs/html/element%2Fcol.html
@@ -0,0 +1,195 @@
+<header><h1>&lt;col&gt;: The Table Column element</h1></header><div class="section-content"><p>The <code>&lt;col&gt;</code> <a href="../index">HTML</a> element defines a column within a table and is used for defining common semantics on all common cells. It is generally found within a <a href="colgroup"><code>&lt;colgroup&gt;</code></a> element.</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/col.html" title="MDN Web Docs Interactive Example" loading="lazy"></iframe> <p><code>&lt;col&gt;</code> allows styling columns using CSS, but only a few properties will have an effect on the column (<a href="https://www.w3.org/TR/CSS21/tables.html#columns" target="_blank">see the CSS 2.1 specification</a> for a list).</p>
+</div>
+<h2 id="attributes">Attributes</h2>
+<div class="section-content">
+<p>This element includes 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;col&gt;</code> element spans. If not present, its default value is <code>1</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> </ul> <p>If this attribute is not set, its value is inherited from the <a href="colgroup#align"><code>align</code></a> of the <a href="colgroup"><code>&lt;colgroup&gt;</code></a> element this <code>&lt;col&gt;</code> element belongs too. If there are none, the <code>left</code> value is assumed.</p> <div class="notecard note" id="sect1"> <p><strong>Note:</strong> To achieve the same effect as the <code>left</code>, <code>center</code>, <code>right</code> or <code>justify</code> values, 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 <code>&lt;col&gt;</code> element. Because <a href="td"><code>&lt;td&gt;</code></a> elements are not descendant of the <code>&lt;col&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. Set <code>a</code> to zero and <code>b</code> to the position of the column in the table, e.g. <code>td:nth-child(2) { text-align: right; }</code> to right-align the second column.</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/color_value#named_colors">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 sets the character to align the cells in a column on. 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.</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 characters 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;col&gt;</code> element. Because <a href="td"><code>&lt;td&gt;</code></a> elements are not descendant of the <code>&lt;col&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 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> <dt id="width">
+<a href="#width"><code>width</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 a default width for each column in the current column group. In addition to the standard pixel and percentage values, this attribute might take the special form <code>0*</code>, which means that the width of each column in the group should be the minimum width necessary to hold the column's contents. Relative widths such as <code>5*</code> also can be used.</p> </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;col&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>None; it is a <a href="https://developer.mozilla.org/en-US/docs/Glossary/Void_element">void element</a>.</td> </tr> <tr> <th scope="row">Tag omission</th> <td>It must have start tag, but must not have an end tag.</td> </tr> <tr> <th scope="row">Permitted parents</th> <td> <a href="colgroup"><code>&lt;colgroup&gt;</code></a> only, though it can be implicitly defined as its start tag is not mandatory. The <a href="colgroup"><code>&lt;colgroup&gt;</code></a> must not have a <a href="colgroup#span"><code>span</code></a> attribute. </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-col-element">HTML Standard <br><small># the-col-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>col</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 pseudo-classes 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/col" class="_attribution-link">https://developer.mozilla.org/en-US/docs/Web/HTML/Element/col</a>
+ </p>
+</div>