html tutorial - colspan Attribute in HTML - html5 - html code - html form

Colspan attribute in html

Learn html - html tutorial - Colspan attribute in html - html examples - html programs

  • The colspan attribute is used to specify the number of columns to span.
  • The colspan attribute can be applied on the <td> and <th> tag.

Syntax for colspan attribute in HTML:

<td colspan ="number">content </td>

Applies To:

Elements Attribute
<td> colspan
<th> colspan

Value of colspan attribute in HTML:

Value Description
value Sets the number of columns the cell should span.

Sample Coding for colspan Attribute in HTML:

Tryit<!DOCTYPE html>
        <title>Wikitechy HTML colspan attribute</title>
        <table border=1>
        <th>Firstname  </th>
        <th>Lastname  </th>
        <td colspan="2">Wikitechy </td>

Code Explanation for colspan Attribute in HTML:

  colspan Attribute Code Explanation

  1. <table> tag - is used to define the data in the table format that will be shown with a border.
  2. <td>tag - used to define data in the cell.
  3. colspan attribute is used to combine the two cells into single cell.

Output fo colspan Attribute in HTML:

  colspan Attribute Tag Output

  1. The output shows the Wikitechy in the single column using the colspan attribute.

Browser Support for colspan Attribute in HTML:

Yes Yes Yes Yes Yes

Related Searches to colspan Attribute in html

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add to your ad blocking whitelist or disable your adblocking software.