summaryrefslogtreecommitdiff
path: root/devdocs/html/element%2Fth.html
diff options
context:
space:
mode:
Diffstat (limited to 'devdocs/html/element%2Fth.html')
-rw-r--r--devdocs/html/element%2Fth.html277
1 files changed, 277 insertions, 0 deletions
diff --git a/devdocs/html/element%2Fth.html b/devdocs/html/element%2Fth.html
new file mode 100644
index 00000000..4ddbde10
--- /dev/null
+++ b/devdocs/html/element%2Fth.html
@@ -0,0 +1,277 @@
+<header><h1>&lt;th&gt;: The Table Header element</h1></header><div class="section-content"><p>The <code>&lt;th&gt;</code> <a href="../index">HTML</a> element defines a cell as the header of a group of table cells. The exact nature of this group is defined by the <a href="#scope"><code>scope</code></a> and <a href="#headers"><code>headers</code></a> attributes.</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/th.html" title="MDN Web Docs Interactive Example" loading="lazy"></iframe></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="abbr"><a href="#abbr"><code>abbr</code></a></dt> <dd> <p>This attribute contains a short abbreviated description of the cell's content. Some user-agents, such as speech readers, may present this description before the content itself.</p> </dd> <dt id="colspan"><a href="#colspan"><code>colspan</code></a></dt> <dd> <p>This attribute contains a non-negative integer value that indicates for how many columns the cell extends. Its default value is <code>1</code>. Values higher than 1000 will be considered as incorrect and will be set to the default value (1).</p> </dd> <dt id="headers"><a href="#headers"><code>headers</code></a></dt> <dd> <p>This attribute contains a list of space-separated strings, each corresponding to the <strong>id</strong> attribute of the <a href="th" aria-current="page"><code>&lt;th&gt;</code></a> elements that apply to this element.</p> </dd> <dt id="rowspan"><a href="#rowspan"><code>rowspan</code></a></dt> <dd> <p>This attribute contains a non-negative integer value that indicates for how many rows the cell extends. Its default value is <code>1</code>; if its value is set to <code>0</code>, it extends until the end of the table section (<a href="thead"><code>&lt;thead&gt;</code></a>, <a href="tbody"><code>&lt;tbody&gt;</code></a>, <a href="tfoot"><code>&lt;tfoot&gt;</code></a>, even if implicitly defined), that the cell belongs to. Values higher than 65534 are clipped down to 65534.</p> </dd> <dt id="scope"><a href="#scope"><code>scope</code></a></dt> <dd> <p>This <a href="https://developer.mozilla.org/en-US/docs/Glossary/Enumerated">enumerated</a> attribute defines the cells that the header (defined in the <a href="th" aria-current="page"><code>&lt;th&gt;</code></a>) element relates to. It may have the following values:</p> <ul> <li>
+<code>row</code>: The header relates to all cells of the row it belongs to.</li> <li>
+<code>col</code>: The header relates to all cells of the column it belongs to.</li> <li>
+<code>rowgroup</code>: The header belongs to a rowgroup and relates to all of its cells.</li> <li>
+<code>colgroup</code>: The header belongs to a colgroup and relates to all of its cells.</li> </ul> <p>If the <code>scope</code> attribute is not specified, or its value is not <code>row</code>, <code>col</code>, or <code>rowgroup</code>, or <code>colgroup</code>, then browsers automatically select the set of cells to which the header cell applies.</p> </dd> </dl>
+</div>
+<h3 id="deprecated_attributes">Deprecated attributes</h3>
+<div class="section-content"><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 enumerated attribute specifies how the cell content's horizontal alignment will be handled. Possible values are:</p> <ul> <li>
+<code>left</code>: The content is aligned to the left of the cell.</li> <li>
+<code>center</code>: The content is centered in the cell.</li> <li>
+<code>right</code>: The content is aligned to the right of the cell.</li> <li>
+<code>justify</code> (with text only): The content is stretched out inside the cell so that it covers its entire width.</li> <li>
+<code>char</code> (with text only): The content is aligned to a character inside the <code>&lt;th&gt;</code> element with minimal offset. This character is defined by the <a href="#char"><code>char</code></a> and <a href="#charoff"><code>charoff</code></a> attributes.</li> </ul> <p>The default value when this attribute is not specified is <code>left</code>.</p> <div class="notecard note" id="sect1"> <p><strong>Note:</strong> Do not use this attribute as it is obsolete in the latest standard.</p> <ul> <li>To achieve the same effect as the <code>left</code>, <code>center</code>, <code>right</code> or <code>justify</code> values, apply the CSS <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/text-align"><code>text-align</code></a> property to the element.</li> <li>To achieve the same effect as the <code>char</code> value, give the <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/text-align"><code>text-align</code></a> property the same value you would use for the <a href="#char"><code>char</code></a>.</li> </ul> </div> </dd> <dt id="axis">
+<a href="#axis"><code>axis</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 contains a list of space-separated strings. Each string is the <code>id</code> of a group of cells that this header applies to.</p> <div class="notecard note" id="sect2"> <p><strong>Note:</strong> Do not use this attribute as it is obsolete in the latest standard: use the <a href="#scope"><code>scope</code></a> attribute instead.</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>This attribute defines the background color of each cell in a column. It consists of a 6-digit hexadecimal code as defined in <a href="https://www.w3.org/Graphics/Color/sRGB" target="_blank">sRGB</a> and is prefixed by '#'.</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>The content in the cell element is aligned to a character. Typical values include a period (.) 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> <div class="notecard note" id="sect3"> <p><strong>Note:</strong> Do not use this attribute as it is obsolete in the latest standard. To achieve the same effect, you can specify the character as the first value of the <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/text-align"><code>text-align</code></a> property.</p> </div> </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 shift column data to the right of the character specified by the <strong>char</strong> attribute. Its value specifies the length of this shift.</p> <div class="notecard note" id="sect4"> <p><strong>Note:</strong> Do not use this attribute as it is obsolete in the latest standard.</p> </div> </dd> <dt id="height">
+<a href="#height"><code>height</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 define a recommended cell height.</p> <div class="notecard note" id="sect5"> <p><strong>Note:</strong> Do not use this attribute as it is obsolete in the latest standard: use the CSS <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/height"><code>height</code></a> property instead.</p> </div> </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 how a text is vertically aligned inside a cell. Possible values for this attribute are:</p> <ul> <li>
+<code>baseline</code>: Positions the text near the bottom of the cell and aligns it with the <a href="https://en.wikipedia.org/wiki/Baseline_%28typography%29" target="_blank">baseline</a> of the characters instead of the bottom. If characters don't descend below the baseline, the baseline value achieves the same effect as <code>bottom</code>.</li> <li>
+<code>bottom</code>: Positions the text near the bottom of the cell.</li> <li>
+<code>middle</code>: Centers the text in the cell.</li> <li>and <code>top</code>: Positions the text near the top of the cell.</li> </ul> <div class="notecard note" id="sect6"> <p><strong>Note:</strong> Do not use this attribute as it is obsolete in the latest standard: use the CSS <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/vertical-align"><code>vertical-align</code></a> property instead.</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 is used to define a recommended cell width. Additional space can be added with the <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement/cellSpacing"><code>cellspacing</code></a> and <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement/cellPadding"><code>cellpadding</code></a> properties and the width of the <a href="col"><code>&lt;col&gt;</code></a> element can also create extra width. But, if a column's width is too narrow to show a particular cell properly, it will be widened when displayed.</p> <div class="notecard note" id="sect7"> <p><strong>Note:</strong> Do not use this attribute as it is obsolete in the latest standard: use the CSS <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/width"><code>width</code></a> property instead.</p> </div> </dd> </dl></div>
+<h2 id="examples">Examples</h2>
+<div class="section-content"><p>See <a href="table"><code>&lt;table&gt;</code></a> for examples on <code>&lt;th&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> <a href="../content_categories#flow_content">Flow content</a>, but with no header, footer, sectioning content, or heading content descendants. </td> </tr> <tr> <th scope="row">Tag omission</th> <td> The start tag is mandatory.<br>The end tag may be omitted, if it is immediately followed by a <a href="th" aria-current="page"><code>&lt;th&gt;</code></a> or <a href="td"><code>&lt;td&gt;</code></a> element or if there are no more data in its parent element. </td> </tr> <tr> <th scope="row">Permitted parents</th> <td>A <a href="tr"><code>&lt;tr&gt;</code></a> element.</td> </tr> <tr> <th scope="row">Implicit ARIA role</th> <td>
+<a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/columnheader_role"><code>columnheader</code></a> or <a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/rowheader_role"><code>rowheader</code></a>
+</td> </tr> <tr> <th scope="row">Permitted ARIA roles</th> <td>Any</td> </tr> <tr> <th scope="row">DOM interface</th> <td><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableCellElement"><code>HTMLTableCellElement</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-th-element">HTML Standard <br><small># the-th-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>th</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">≤12.1</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">≤12.1</td>
+<td class="bc-supports-yes">1</td>
+<td class="bc-supports-yes">1.0</td>
+</tr>
+<tr>
+<th><code>abbr</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>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>axis</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>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">≤4</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">≤3.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-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>colspan</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>headers</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>rowspan</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>scope</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>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">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>
+</tbody>
+</table></div>
+<h2 id="see_also">See also</h2>
+<div class="section-content"><ul> <li>Other table-related HTML Elements: <a href="caption"><code>&lt;caption&gt;</code></a>, <a href="col"><code>&lt;col&gt;</code></a>, <a href="colgroup"><code>&lt;colgroup&gt;</code></a>, <a href="table"><code>&lt;table&gt;</code></a>, <a href="tbody"><code>&lt;tbody&gt;</code></a>, <a href="td"><code>&lt;td&gt;</code></a>, <a href="tfoot"><code>&lt;tfoot&gt;</code></a>, <a href="thead"><code>&lt;thead&gt;</code></a>, <a href="tr"><code>&lt;tr&gt;</code></a>.</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/th" class="_attribution-link">https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th</a>
+ </p>
+</div>