<w> smolweb

td: The Table Data Cell element

The <td> HTML element defines a cell of a table that contains data. It participates in the table model and is included in <tr> (table rows).

Attributes

Specific attributes

Allowed attributes

colspan="[number]" contains a non-negative integer value that indicates how many columns the data cell spans or extends. The default value is 1.

headers="[list of header ids]" contains a list of space-separated strings, each corresponding to the id attribute of the <th> elements that provide headings for this table cell.

rowspan="[number]" contains a non-negative integer value that indicates how many rows the data cell spans or extends. The default value is 1.

Global attributes

accesskey Specifies a keyboard shortcut to activate or focus an element.

aria-* Defines accessibility properties and states for assistive technologies.

class Specifies one or more CSS class names for styling the element.

data-* Stores custom data private to the page or application.

dir Sets the text direction (left-to-right, right-to-left, or auto).

hidden Hides the element from display and assistive technologies.

id Defines a unique identifier for the element within the document.

inputmode Hints which virtual keyboard type to display on mobile devices.

itemid Provides a global identifier for microdata items.

itemprop Defines a property name-value pair for microdata.

itemref Associates properties with an item via element IDs for microdata.

itemscope Creates a new microdata item container.

itemtype Specifies the vocabulary URL for microdata items (like Schema.org).

lang Specifies the primary language of the element’s content.

nonce Provides a cryptographic nonce for Content Security Policy.

role Defines the element’s semantic role for accessibility.

tabindex Controls keyboard navigation order and focusability.

title Provides advisory information displayed as a tooltip.

Example

<table>
    <caption>Average Monthly Temperatures (°C)</caption>
    <thead>
        <tr>
            <th>City</th>
            <th>Jan</th>
            <th>Feb</th>
            <th>Mar</th>
            <th>Apr</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>Paris</td>
            <td>5.2</td>
            <td>6.1</td>
            <td>9.3</td>
            <td>12.4</td>
        </tr>
        <tr>
            <td>Lyon</td>
            <td>3.8</td>
            <td>5.4</td>
            <td>9.1</td>
            <td>13.2</td>
        </tr>
        <tr>
            <td>Marseille</td>
            <td>7.9</td>
            <td>9.2</td>
            <td>12.1</td>
            <td>15.3</td>
        </tr>
    </tbody>
    <tfoot>
        <tr>
            <th>Average</th>
            <td>5.6</td>
            <td>6.9</td>
            <td>10.2</td>
            <td>13.6</td>
        </tr>
    </tfoot>
</table>