HTML colspan
Published Jul 31, 2021Updated Sep 3, 2021
The colspan attributed defines the number of columns a cell should span.
Syntax
<table><tr><th>Cell 1</th><th>Cell 2</th></tr><tr><td>Cell 3</td><td>Cell 4</td></tr><tr><!-- Spans two columns --><td colspan="2">Cell 5</td></tr></table>
The following elements support colspan:
<td><th>
Example 1
A table with a cell that spans two columns.
<table><tr><!-- Spans two columns --><th colspan="2">Languages and Frameworks</th></tr><tr><td>Python</td><td>Django</td></tr><tr><td>JavaScript</td><td>React.js</td></tr><tr><td>Ruby</td><td>Ruby on Rails</td></tr></table>
![Table with a cell that spans two columns]
Learn HTML on Codecademy
- Front-end engineers work closely with designers to make websites beautiful, functional, and fast.
- Includes 34 Courses
- With Professional Certification
- Beginner Friendly.115 hours
- In this CSS tutorial, you’ll learn how to add CSS to visually transform HTML into eye-catching sites.
- Beginner Friendly.6 hours