HTML DOM TableHeader colSpan Property Last Updated : 24 Aug, 2022 Summarize Comments Improve Suggest changes Share Like Article Like Report The HTML DOM TableHeader colSpan property is used to set or return the value of the colspan attribute. The colspan attribute defines the number of columns that a header cell should span. Syntax: It returns the colSpan property.tableheaderObject.colSpanIt is used to set the colSpan property.tableheaderObject.colSpan = number Property Values: It contains a single value i.e numeric which represents the number of columns that a header cell should span. Return Value: It returns a numeric value that represents the number of columns. Example 1: This example returns a colSpan property. HTML <!DOCTYPE html> <html> <head> <!-- style to set border --> <style> table{ border:3px solid black; } td{ border: 1px solid green; } </style> </head> <body> <h2>GeeksforGeeks</h2> <b>DOM TableHeader colSpan property</b> <br/><br/> <table> <tr> <th id="tableHeaderID" colspan="2"> User Expense </th> </tr> <tr> <td>Arun</td> <td>$10</td> </tr> <tr> <td>Priya</td> <td>$8</td> </tr> <tr> <td>Tom</td> <td>$18</td> </tr> </table> <br> <button onclick="myGeeks()"> Click to get number of columns </button> <p id="paraID" style="font-size:25px; color:green"> </p> <!-- script to return TableHeader colSpan Property --> <script> function myGeeks() { var tab = document.getElementById( "tableHeaderID").colSpan; document.getElementById( "paraID").innerHTML = tab; } </script> </body> </html> Output: colSpan property Example 2: Below code is used to set the colSpan property. HTML <!DOCTYPE html> <html> <head> <!-- style to set border --> <style> table { border: 2px solid black; } td { border: 1px solid green; } </style> </head> <body> <h2>GeeksforGeeks</h2> <b>DOM TableHeader colSpan Property</b> <br/><br/> <table> <tr> <th id="tableHeaderID" colspan="2"> User Expense </th> </tr> <tr> <td>Arun</td> <td>$10</td> </tr> <tr> <td>Priya</td> <td>$8</td> </tr> <tr> <td>Tom</td> <td>$18</td> </tr> </table> <br> <button onclick="myGeeks()"> Click to get value of colspan </button> <p id="paraID" style="font-size:20px; color:green"> </p> <!-- script to set TableHeader colSpan Property --> <script> function myGeeks() { var tab = document.getElementById( "tableHeaderID").colSpan="4"; document.getElementById( "paraID").innerHTML = "The value of the colspan attribute was changed to: " + tab; } </script> </body> </html> Output: colSpan property Supported Browsers: Google chromeEdgeMozilla FirefoxOperaSafari Comment More infoAdvertise with us Next Article HTML DOM TableHeader colSpan Property M manaschhabra2 Follow Improve Article Tags : Technical Scripter Web Technologies HTML HTML-DOM HTML-Property +1 More Similar Reads HTML | DOM TableData colSpan Property The Dom TableData colSpan Property in HTML DOM is used to set or return the value of a colspan attribute. The colspan attribute is used to specify the number of columns a table should span. Syntax: It returns the colSpan property. tabledataObject.colSpanIt is used to set the colSpan property. tabled 2 min read HTML DOM TableHeader cellIndex Property the TableHeader cellIndex Property in HTML DOM is used for returning the position of a cell in the cells collection of a table row. Syntax: It returns the cellIndex Property:tableheaderObject.cellIndex Return Value: It returns a numeric value that represents the position of the cell in the cells col 1 min read HTML | DOM TableHeader abbr Property The DOM TableHeader abbr Property is used to sets or returns the value of the abbr attribute. The abbr attribute is used to specify the shorter version of the content in a header cell. It has no visual effect on the ordinary web browser and can be used by screen readers. Syntax: It returns the abbr 2 min read HTML DOM Table cellSpacing Property The HTML DOM Table cellSpacing Property is used to set or return the value of the cellSpacing attribute of an <table> element. The cellSpacing attribute is used to define the spaces between the cells. Note: This property is no longer supported in HTML5. Syntax It returns the cellSpacing Proper 2 min read HTML | DOM Table tHead Property The Table tHead property is used for returning a reference to the <thead> element of a table. The <thead> element is used for grouping the header content in an HTML table. It returns NULL if the <thead> element is not defined.Syntax tableObject.tHeadReturn Value : A reference to th 1 min read Like