HTML Tables


HTML tables provide a way for web developers to organise data systematically by arranging it in rows and columns.



Define an HTML Table

In HTML, a table is formed by using table cells placed within rows and columns.


Table Cells

In HTML, each table cell is represented by the <td> and a </td> tag.

The td stands for table data. Anything enclosed between the <td> and </td> tags constitutes the content of the respective table cell.

Note: A table cell can hold a diverse range of HTML elements, such as text, images, lists, links, other tables, and more etc.


Table Rows

In HTML, every table row is delineated by the <tr> and ends with a </tr> tags. Thetr stands for table row.


Table Headers

Occasionally, you may need specific cells to serve as table header cells. In such instances, utilize the <th> tag instead of the <td> tag:

th stands for table header.

Typically, the text inside elements is both bold and centered. However, you have the option to modify this appearance using CSS.


HTML Table Headers

HTML tables can include headers for each column or row, or for multiple columns/rows.

EMIL TOBIAS LINUS
     
     
     
     
     
8:00    
9:00    
10:00    
11:00    
12:00    
13:00    
MON TUE WED THU FRI
8:00          
9:00          
10:00          
11:00          
12:00          
DECEMBER
     
     
     
     
     

Vertical Table Headers

To make the first column of a table act as headers, designate the initial cell in each row as a element.


HTML Table Colspan & Rowspan

HTML tables can contain cells that cover more than one row and/or column.

NAME  
     
     
     
     
APRIL    
   
   
     
     
2022
     
FIESTA  
 
     

HTML Table - Colspan

To have a cell cover more than one column, apply the colspan attribute in your HTML code.

Note: The colspan attribute's value tells how many columns it should cover.


HTML Table - Rowspan

To have a cell cover more than one row in a table, utilize the rowspan attribute.

Note: The rowspan attribute's value shows how many rows it should cover.