Home Tutorials HTML Tutorial Tables
Tables

Tables


18. Tables

Tables are built using <table>, rows with <tr>, header cells with <th>, and data cells with <td>. They are intended for tabular data rather than page layout.

Syntax

<table>
    <tr>
        <th>Name</th>
        <th>Age</th>
    </tr>
    <tr>
        <td>Ravi</td>
        <td>21</td>
    </tr>
</table>

Example

<table border="1">
    <tr>
        <th>Name</th>
        <th>Course</th>
    </tr>
    <tr>
        <td>Ramesh</td>
        <td>HTML</td>
    </tr>
</table>

Output

A table with one header row and one data row is displayed.
Example

🏋️ Test Yourself With Exercises

Take our quiz on Tables to test your knowledge.

Browse Quizzes »