Difference between Cellpadding and Cellspacing Last Updated : 31 Jul, 2020 Comments Improve Suggest changes 10 Likes Like Report Cellpadding: Cellpadding specifies the space between the border of a table cell and its contents (i.e) it defines the whitespace between the cell edge and the content of the cell. Syntax: <table cellpadding="value" >.....</table> where, value determines the padding (space between the border of a table and its content) Cellspacing: Cellspacing specifies the space between cells (i.e) it defines the whitespace between the edges of the adjacent cells. Syntax: <table cellspacing="value" >.....</table> where, value determines the padding (space between adjacent cells) Example: html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style> span{ text-decoration-style: solid; width: 25px; font-size: x-large; color: blueviolet; } </style> </head> <body> <table border="1" cellpadding="4" cellspacing="5"> <thead> <td><span>Name</span></td> <td><span>Age</span></td> </thead> <tbody> <tr> <td>Rani</td> <td>30</td> </tr> <tr> <td>Rajan</td> <td>35</td> </tr> <tr> <td>Akshaya</td> <td>17</td> </tr> <tr> <td>Ashick</td> <td>13</td> </tr> </tbody> </table> </body> </html> Output: Difference between cellpadding and cellspacing: Cellpadding Cellspacing It specifies the space between the border of a table cell and its contents.It specifies the space between adjacent cells.It is created by using HTML <table> tag but type attribute is set to cellpadding.It is also created by using HTML <table> tag but type attribute is set to cellspacing.It is mainly meant for a single cell.Cellspacing can get subjected to more than one cell.The default cellpadding value is 1 Whereas, the default cellspacing value is 2Cellpadding is widely used and considered to be an effective meanCellspacing is less effective than Cellpadding.Cellpadding is an attributeCellspacing is also an attribute. Create Quiz Comment A akshara_a Follow 10 Improve A akshara_a Follow 10 Improve Article Tags : Web Technologies HTML HTML-Basics 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