Elements/th - HTML Wiki
Có thể bạn quan tâm
- List of Elements
- Tables
- table
- caption
- colgroup
- col
- tbody
- thead
- tfoot
- tr
- td
- th
- Tables
Contents
- 1 <th>
- 1.1 Point
- 1.2 HTML Attributes
- 1.3 Examples
- 1.3.1 Example A
- 1.3.2 Example B
- 1.3.3 Example C
- 1.3.4 Example D
- 1.4 HTML Reference
The <th> element represents a header cell in a table.
Point
- The th element can specify the cell which the influence of headding cell reaches by the scope attribute.
HTML Attributes
- colspan = valid non-negative integerThis attribute gives the number of columns respectively that the cell is to span.
- rowspan = valid non-negative integerThis attribute gives the number of rows respectively that the cell is to span. [Example B]
- headers = unordered set of unique space-separated tokensThe value of this attribute must have the value of an id attribute of the th element that is targeted. [Example C]
- scope = row/ col/ rowgroup/ colgroupThe scope attribute specifies the cell which the influence of headding cell reaches. [Example D]
- rowThe header cell applies to some of the subsequent cells in the same row(s).
- colThe header cell applies to some of the subsequent cells in the same column(s).
- rowgroupThe header cell applies to all the remaining cells in the row group. A th element's scope attribute must not be in the row group state if the element is not anchored in a row group.
- colgroupThe header cell applies to all the remaining cells in the column group. A th element's scope attribute must not be in the column group state if the element is not anchored in a column group.
See also global attributes.
Examples
Example A
[try it]
<table> <caption> <p>table 1. List of HTML elements</p> </caption> <thead> <tr> <th>Number</th> <th>element</th> </tr> </thead> <tbody> <tr> <td>4.1.1</td> <td>html</td> </tr> <tr> <td>4.2.1</td> <td>head</td> </tr> </tbody> </table>Example B
[try it]:
<table> <caption> <p>table 1. Sample table</p> </caption> <tr> <td rowspan="2">1</td> <td>2</td> </tr> <tr> <td>3</td> </tr> </table>Example C
Use case of the headers attribute [try it]:
<table> <caption> <p>table 1. List of HTML elements</p> </caption> <thead> <tr> <th id="c1">Number</th> <th id="c2">element</th> </tr> </thead> <tbody> <tr> <td headers="c1">4.1.1</td> <td headers="c2">html</td> </tr> <tr> <td headers="c1">4.2.1</td> <td headers="c2">head</td> </tr> </tbody> </table>Example D
The scope attribute specifies the cell which the influence of headding cell reaches [try it]:
<table> <caption> <p>table 1. List of HTML elements</p> </caption> <thead> <tr> <th scope="row">Number</th> <th scope="row">element</th> </tr> </thead> <tbody> <tr> <td>4.1.1</td> <td>html</td> </tr> <tr> <td>4.2.1</td> <td>head</td> </tr> </tbody> </table>HTML Reference
The HTML5 specification defines the <th> element in 4.9.10 The th element.
Từ khóa » Html Th Column
-
HTML Th Tag - W3Schools
-
HTML Th Colspan Attribute - W3Schools
-
For A Column Instead Of Row? - Stack Overflow : The Table Header Element - HTML - MDN Web Docs - Mozilla HTML:
Tag - TechOnTheNet HTML |
Colspan Attribute - GeeksforGeeks HTML |
Width Attribute - GeeksforGeeks HTML Tag » Tables With Two Headers | Web Accessibility Initiative (WAI) | W3C
HTML
Tag - Computer Hope HTML Th Tag - Learn HTML | W3Docs
Advanced Table Settings: Column Width, Alignment And Merging Cells
HTML Tables – Table Tutorial With Example Code - FreeCodeCamp
HTML - Tables - Tutorialspoint
Copyright © 2022 | Thiết Kế Truyền Hình Cáp Sông Thu