HTML <table> cellspacing Attribute Last Updated : 20 Sep, 2024 Comments Improve Suggest changes Like Article Like Report The cellspacing attribute in HTML is used to define the space between cells in a table. It controls the amount of space, in pixels, between the table cells. This spacing can make the table's content more readable by adding extra room between cells.However, it's important to note that the cellspacing attribute is not supported in HTML5, and modern developers usually use CSS to manage the space between cells.Note: The <table> cellspacing Attribute is not supported by HTML 5.Syntax:<table cellspacing="pixels">Attribute Values:Attribute ValueDescriptionpixelsIt sets the space between the cells in terms of pixels.Example 1: Table with CellspacingIn this example, we set the cellspacing attribute to 10 pixels, meaning there will be a 10-pixel gap between each cell. html <!DOCTYPE html> <html> <head> <title> HTML table cellspacing Attribute </title> <style> body { text-align: center; } table { margin: 0 auto; } </style> </head> <body> <h1 style="color: green;"> GeeksforGeeks </h1> <h2>HTML table cellspacing Attribute</h2> <table border="1" cellspacing="15"> <caption> Author Details </caption> <tr> <th>NAME</th> <th>AGE</th> <th>BRANCH</th> </tr> <tr> <td>BITTU</td> <td>22</td> <td>CSE</td> </tr> <tr> <td>RAM</td> <td>21</td> <td>ECE</td> </tr> </table> </body> </html> Output:Example 2: Table with Different CellspacingLet’s try a different value for the cellspacing attribute. Here, we set the cellspacing to 10 pixels: HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Cellspacing Example</title> <style> body { text-align: center; } table { margin: 0 auto; } </style> </head> <body> <h1 style="color: green;"> GeeksforGeeks </h1> <h2>Table with Cellspacing</h2> <table border="1" cellspacing="10"> <tr> <td>Row 1, Cell 1</td> <td>Row 1, Cell 2</td> </tr> <tr> <td>Row 2, Cell 1</td> <td>Row 2, Cell 2</td> </tr> </table> </body> </html> Output:Supported Browsers:Google Chrome 1Microsoft Edge 12Firefox 1 Opera 12.1 Safari 1 While the cellspacing attribute was once a common way to control the space between table cells in HTML, it is no longer supported in HTML5. Instead, you should use CSS for this purpose, which gives you greater control and flexibility. Comment More infoAdvertise with us Next Article HTML <table> cellspacing Attribute jit_t Follow Improve Article Tags : Web Technologies HTML HTML-Attributes Similar Reads HTML <table> cellpadding Attribute The HTML <table> cell padding Attribute is used to specify the space between the cell content and cell wall. The cellpadding attribute is set in terms of pixels. By default, the padding is set to 0. Note: The <table> cellpadding Attribute is not supported by HTML5. Syntax:<table cellp 1 min read HTML | <td>colspan Attribute The HTML <td> colspan Attribute is used to specify the number of columns a table should span. Syntax: <td colspan="number"> Attribute Values: It contains the numeric value which specifies the number of columns a cell should span. Example: This Example illustrates the use of colspan attri 1 min read HTML | <th> colspan Attribute The <th> colspan Attribute in HTML is used to specify a number of columns a header cell should span. Syntax: <th colspan="number"> Attribute Values: It contains single value number which contains the numeric value to sets the number of column a header cell should span. Example: This exam 1 min read HTML | <textarea> cols Attribute The HTML <textarea> cols Attribute is used to tell the browser how many average-width characters should fit on a single line i.e the number of columns to display. It is used to specify the visible width of the <Textarea> Element. Syntax: <textarea cols="number"> Attribute Values: I 1 min read HTML | <td> char Attribute The HTML <td> char Attribute is used to specify the alignment to the character of content in a table cell. This attribute only contains char align attribute. Its default value is a decimal point for page language. It is not supported by HTML 5. Syntax: <td char="character"> Attribute Val 1 min read HTML <th> char Attribute The HTML <th> char attribute is used to specify the alignment to the character of content in a table header cell. It only contains the char align attribute. Its default value is a decimal point for page language. Note: It is not supported by HTML5. Syntax: <th char="character"> Attribute 1 min read HTML | <col> span Attribute The HTML <col> span Attribute is used to specify how many numbers of col element should span. Syntax: <col span="number"> Attribute Values: It contains the numeric value which specifies the number of col element should span. Example: html <!DOCTYPE html> <html> <head> 1 min read HTML | <col> valign Attribute The HTML <col> valign attribute is used to specify the vertical alignment of the text content in a column element. Syntax:<col valign="top | middle | bottom | baseline">Attribute Values:top: It sets the content to top-align.middle: It sets the content to middle-align.bottom: It sets the 1 min read HTML | <col> width Attribute The HTML <col> width Attribute is used to specify the width of a column element. If width attribute is not set then it takes default width according to content. It is not supported by HTML 5. Syntax: <col width="pixels | % | relative_length"> Attribute Values: pixels: It sets the width o 1 min read HTML | <table> rules Attribute The HTML <table> rules Attribute is used to specify which parts of the inside borders that should be visible. Syntax: <table rules="value"> Attribute Values: none: It does not create any lines.groups: It create lines between row and column groups.rows: It creates line between the rows.co 1 min read Like