📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials HTML Fundamentals Tables

Tables

5 min read Quiz at the end
Tables organise tabular data only — never use them for page layout. Include thead, tbody, and a caption element. Always add scope to th elements. colspan spans columns and rowspan spans rows.

HTML Tables

<table>
    <caption>User List</caption>
    <thead>
        <tr>
            <th scope="col">Name</th>
            <th scope="col">Age</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>Alice</td>
            <td>28</td>
        </tr>
    </tbody>
</table>
Topic Quiz · 5 questions

Test your understanding before moving on

1. Which element wraps table header cells?
💡 <th> marks header cells — they are bold and centred by default.
2. Which element wraps table body rows?
💡 <tbody> groups the main body rows of a table.
3. The scope attribute on <th> is for:
💡 scope="col" or scope="row" helps screen readers associate headers with data cells.
4. What does <caption> do?
💡 <caption> provides a title for the table, displayed above it and read by screen readers.
5. Which attribute spans a cell across columns?
💡 colspan="2" makes a cell span 2 columns.