+ 2
What is difference between cellpadding and cellspacing attribute of table tag in html ?
5 Réponses
+ 16
<!DOCTYPE html>
<html>
<head>
<style>
td {
background:red;
}
</style>
<title>Page Title</title>
</head>
<body>
<table cellpadding=50>
<tr>
<td>A</td>
<td>B</td>
</tr>
</table>
<table cellspacing=50>
<tr>
<td>C</td>
<td>D</td>
</tr>
</table>
</body>
</html>
+ 3
Cellspacing specifies the amount of space between one cell and other cells while cellpadding specifies the amount of space between the contents of a single cell and the cell border.
+ 1
Hey Akshay can you please elaborate cellspacing ?
+ 1
cellspacing adds more space outside the border of a cell
| cell1-content | <-cellspacing-> | cell2-content |
while padding is within a single cell
| <-cellpadding-> cell-content <-cellpadding-> |
- 1
Check the dictionary the meaning of -
-
Padding and Spacing
then you will understand.
-
and try coding HTML in Playground to check the difference.
^_^