HTML | DOM Table width Property Last Updated : 30 May, 2022 Comments Improve Suggest changes Like Article Like Report The Table width property in HTML DOM is used to set or return the value of the width attribute of a table. Note: This property is not supported by HTML5. Syntax: It returns the width property of a table.tableObject.width;It is used to set the width property of a table.tableObject.width ="pixels"; Attribute Values: pixels: It sets the width of a table in terms of pixels.%: It sets the width of table in terms of percentage (%). Return Values: It returns a numeric value which represents the width of the table element. Note: It is not supported by HTML 5. Example 1: This example returns the width property of a table. html <!DOCTYPE html> <html> <head> <title> HTML DOM table width Property </title> </head> <body> <h1>GeeksforGeeks</h1> <h2>HTML DOM table width Property</h2> <table border="1" id = "gfg" width="250"> <tr> <th>NAME</th> <th>AGE</th> <th>BRANCH</th> </tr> <tr> <td>BITTU</td> <td>22</td> <td>CSE</td> </tr> </table> <br><br> <button ondblclick="thead()"> Return width </button> <p id="sudo"></p> <script> function thead() { var x = document.getElementById("gfg").width; document.getElementById("sudo").innerHTML = x; } </script> </body> </html> Before Clicking the Button: After Clicking the Button: Example 2: This example sets the width property of a table. html <!DOCTYPE html> <html> <head> <title> HTML DOM table width Property </title> </head> <body> <h1>GeeksforGeeks</h1> <h2>HTML DOM table width Property</h2> <table border="1" id = "gfg" width="250"> <tr> <th>NAME</th> <th>AGE</th> <th>BRANCH</th> </tr> <tr> <td>BITTU sehgl</td> <td>22</td> <td>CSE</td> </tr> </table> <br><br> <button ondblclick="thead()"> Return width </button> <br> <br> <p id="sudo"></p> <script> function thead() { var x = document.getElementById("gfg").width = "350"; document.getElementById("sudo").innerHTML = "The width ws set to" + x; } </script> </body> </html> Before Clicking the Button: After Clicking the Button: Supported Browsers: Google Chrome 6.0Internet Explorer 10.0Firefox 16.0Apple Safari 5.0Opera 10.6O Create Quiz Comment M manaschhabra2 Follow 0 Improve M manaschhabra2 Follow 0 Improve Article Tags : Web Technologies HTML HTML-DOM Explore HTML BasicsHTML Introduction4 min readHTML Editors4 min readHTML Basics7 min readStructure & ElementsHTML Elements4 min readHTML Attributes7 min readHTML Headings3 min readHTML Paragraphs3 min readHTML Text Formatting4 min readHTML Block and Inline Elements3 min readHTML Charsets4 min readListsHTML Lists3 min readHTML Ordered Lists5 min readHTML Unordered Lists4 min readHTML Description Lists3 min readVisuals & MediaHTML Colors11 min readHTML Links Hyperlinks2 min readHTML Images7 min readHTML Favicon4 min readHTML Video4 min readLayouts & DesignsHTML Tables9 min readHTML Iframes4 min readHTML Layout4 min readHTML File Paths3 min readProjects & Advanced TopicsHTML Forms4 min readHTML5 Semantics5 min readHTML URL Encoding4 min readHTML Responsive Web Design11 min readTop 10 Projects For Beginners To Practice HTML and CSS Skills8 min readTutorial ReferencesHTML Tags - A to Z List5 min readHTML Attributes Complete Reference8 min readHTML Global Attributes5 min readHTML5 Complete Reference8 min readHTML5 MathML Complete Reference3 min readHTML DOM Complete Reference15+ min readHTML DOM Audio/Video Complete Reference2 min readSVG Element Complete Reference5 min readSVG Attribute Complete Reference8 min readSVG Property Complete Reference7 min readHTML Canvas Complete Reference4 min read Like