The colspan attribute is an HTML feature that enables a table cell in a web page to extend over multiple columns. HTML is one of the main ways in which web pages are created. One way to bring structure into an HTML web page is the concept of a table. A table has multiple rows and columns. The information in the individual cells of the table appears vertically and horizontally organized.
Often, when displaying an HTML table, one would like some information to apply or spread over multiple columns. When such a piece of information is limited to one row, then the colspan attribute comes in handy. Therefore colspan=N, where N is some number such as 2, 3, etc., indicates that the cell spreads or spans that many columns.
Consider an example where sales data is shown as a table with three column headings: the sales region, the person heading the region, and the sales amount. When the total is shown, only the sales amount total is of interest. The person cell will be empty in that row. Rather than showing an empty cell it is nice to bring attention to the total instead. The following code achieves this.