HTML <td>colspan Attribute (original) (raw)

Last Updated : 22 May, 2026

The colspan attribute in the tag is used to make a table cell span across multiple columns, allowing you to merge cells horizontally.

Syntax

Attribute Value

It contains the numeric value which specifies the number of columns a cell should span.

**Example: Illustrates the use of colspan attribute in Table data Element.

html `

HTML <td>colspan Attribute

GeeksforGeeks

HTML colspan Attribute

<table>
    <tr>
        <th>Name</th>
        <th>Expense</th>
    </tr>
    <tr>
        <td>Alen</td>
        <td>&#8377;10</td>
    </tr>
    <tr>
        <td>Nicol</td>
        <td>&#8377;8</td>
    </tr>

    <!-- The last row -->
    <tr>
        <!-- This td will span 
            two columns, that is 
            a single column will 
            take up the space of 2 -->
        <td colspan="2">
          Sum: &#8377;18
      </td>
    </tr>
</table>

`