How to Use the <table> Tag in HTML (With Examples Video in Khmer)

How to Use the <table> Tag in HTML (With Examples)

If you want to display data as table, you can use the <table> tag in HTML.

Table is an easy way to display data in a structured format.


1. Basic Table Structure

A basic table in HTML consists of the following elements:

  • <table>: The container for the table
  • <tr>: A table row
  • <th>: A table header cell
  • <td>: A table data cell
How to Create Student Schedule using Table tag HTML in Khmer

Example of a Simple Table

Header 1 Header 2 Header 3
Data 1 Data 2 Data 3
Data 4 Data 5 Data 6

<table border="1">
        <tr>
            <th>Header 1</th>
            <th>Header 2</th>
            <th>Header 3</th>
        </tr>
        <tr>
            <td>Data 1</td>
            <td>Data 2</td>
            <td>Data 3</td>
        </tr>
        <tr>
            <td>Data 4</td>
            <td>Data 5</td>
            <td>Data 6</td>
        </tr>   
    </table>

2. Table Attributes

HTML tables can have several attributes to enhance their functionality:

  • border: Specifies the width of the border around the table
  • cellpadding: Specifies the space between the cell wall and the cell content
  • cellspacing: Specifies the space between the cells
  • width: Specifies the width of the table
  • height: Specifies the height of the table
  • align: Specifies the alignment of the table (left, center, right)
  • bgcolor: Specifies the background color of the table
  • rowspan: Specifies the number of rows a cell should span
  • colspan: Specifies the number of columns a cell should span
Create Students Score using Table with attributes HTML in Khmer

Free Khmer Ebook Download (PDF): Database | Microsoft Access | Python Programming

Previous Post Next Post