Learn HTML: Tables

Table Tags

Tag Name Description
<table> Table Element In HTML, the <table> element has content that is used to represent a two-dimensional table made of rows and columns.
<thead> Table Head Element The table head element, <thead>, defines the headings of table columns encapsulated in table rows.
<tbody> Table Body Element The table body element, <tbody>, is a semantic element that will contain all table data other than table heading and table footer content. If used, <tbody> will contain all table row elements and indicates that <tr> elements make up the body of the table. <table> cannot have both <tbody> and <tr> as direct children.
<th> Table Heading Element The table heading element <th>, is used to add titles to rows and columns of a table and must be enclosed in a table row element, <tr>.
<tr> Table Row Element The table row <tr>, is used to add rows to a table before adding table data and table headings.
<td> Table Data Element The table data element <td>, can be nested inside a table row element, <tr>, to add a cell of data to a table.
<tfoot> Table Footer Element The table footer element <tfoot>, uses table rows to give footer content or to summarize content at the end of a table.

Table Attributes

Attribute Name Description
colspan Colspan Attribute The colspan attribute on a table header <th> or table data <td> element indicates how many columns that particular cell should span within the table. The colspan value is set to 1 by default and will take any positive integer between 1 and 1000.
rowspan Rowspan Attribute Similar to colspan, the rowspan attribute on a table header <th> or table data <td> element indicates how many rows that particular cell should span within the table. the rowspan value is set to 1 by default and will take any positive integer up to 65534.