caption

I. Description

The HTML caption element is used to provide a caption to HTML tables. There may only be one caption element per HTML table. The caption element should be the first child of the html table.

II. Examples

<!DOCTYPE html>
<html>
    <head>
        <title>Example Page</title>
    </head>
    <body>
        <h1>A Table With A Caption</h1>
        <table>
            <caption>Weather For This Upcoming Week</caption>
            <thead>
                <tr>
                    <th colspan="3">Weather For The Next 3 Days</th>
                </tr>
                <tr>
                    <th>Day</th>
                    <th>Overnight Low (Fahrenheit)</th>
                    <th>Daily High (Fahrenheit)</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>2025-04-01, Tuesday</td>
                    <td>41 degrees</td>
                    <td>69 degrees</td>
                </tr>
                <tr>
                    <td>2025-04-02, Wednesday</td>
                    <td>45 degrees</td>
                    <td>72 degrees</td>
                </tr>
                <tr>
                    <td>2025-04-03, Thursday</td>
                    <td>44 degrees</td>
                    <td>76 degrees</td>
                </tr>
            </tbody>
        </table>
    </body>
</html>