The HTML colspan attribute
Quick answer
The HTML colspan attribute makes a table cell span multiple columns. It is used on the <td> and <th> elements.
Overview
Syntax
<td colspan="2">Spans two columns</td>
Values
| Value |
|---|
| A positive integer (default 1). |
Example
<style>table{border-collapse:collapse}th,td{border:1px solid #cbd5e1;padding:6px 10px}</style>
<table><tr><td colspan="2">A + B</td></tr><tr><td>A</td><td>B</td></tr></table>
Best practices
Frequently asked questions
What does the colspan attribute do?
Spans a table cell across columns.