i

Learn HTML and CSS in 10 Days

Table Header

To provide a heading to a row or column of cells, we use the table header element, . The functionality of the element is same as that of the element. The only difference is that the element is used to write a generic piece of data while the element provides semantic value by signifying that the data within the cell is a heading.

The difference between the two elements is the same as that between the paragraphs and the headings. The content of a heading can be easily placed inside a paragraph, but it's of no use. Explicitly utilizing a heading enhances the content’s value. The same goes true for the table headers.

Table headers may be utilized within both rows and columns; the data inside a table defines the appropriate position of a header. The ‘scope’ attribute helps the developer distinguish precisely what content a table header identifies with. The 'scope' attributes take the value as 'col, 'row', 'rowgroup', and 'colgroup'. The most commonly used values are 'row' and 'col'. The 'row' value signifies that each cell inside the row points directly to that table header, and the 'col' value signifies that each cell inside the columns points directly to that table header.