<td> Tag in HTML | Table Data Cell

The <td> tag is used to define a cell in a table that holds data. It is placed within the <tr> (table row) tag and represents individual data within the table. The <td> tag can hold text, images, links, or other HTML elements.

Key Points on <td> Tag:

Syntax of <td> Tag:

Syntax Example

<tr>
            <td>Data in Cell</td>
        </tr>

Example of <td> Tag in HTML:

This example demonstrates how to use the <td> tag to create a table with two columns.

Code Example

<!DOCTYPE html>
        <html lang="en">
        <head>
            <meta charset="UTF-8">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <title>Table Data Example</title>
        </head>
        <body>
        
            <table border="1">
                <tr>
                    <th>Name</th>
                    <th>Age</th>
                </tr>
                <tr>
                    <td>John Doe</td>
                    <td>30</td>
                </tr>
                <tr>
                    <td>Jane Smith</td>
                    <td>25</td>
                </tr>
            </table>
        
        </body>
        </html>

Output

Name Age
John Doe 30
Jane Smith 25

Attributes of <td> Tag:

The <td> tag is essential for displaying data in a table. It allows for organized representation of information and can be customized with various attributes to control the layout and appearance of the table.