HTML Tables CheatSheet

Table elements

Tables

Tag Name Description
<table> Table This element is used to represent a 2-dimentional table of rows and columns
<thead> Table head Defines and separates the headings from the rest of the table
<tbody> Table body The table body element will contain all table data other than the table heading or table footer, this contains the table row elements
<tr> Table row The table row elememt is used to add rows to the table before adding data and headings
<td> Table data This element can be nested in a table row element and is used to add data to a table

Attributes

Colspan

This attribute indicates the number of columns a particular cell should span in a table

Example:


<td colspan="2">Table cell spans two columns</td>

Table cell spans two columns
Data Data

Rowspan

This particular attribute indicates the number of rows a particular cell should span

Example:


<td rowspan="2">Table cell spans two rows</td>

Table cell spans two rows Data Data
Data Data