1) The cellspacing attribute specifies the space, in pixels, between cells.
2) The cellpadding attribute specifies the space, in pixels, between the cell wall and the cell content.
The cellspacing, cellpadiing attribute is not supported in HTML5.
syntax:
table cellspacing="50" cellpadding = "10"
end table
<p>Table with cellspacing:</p>
<table cellspacing="50" cellpadding = "10">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
</table>
3) CSS Example To add padding to a table
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
}
th, td {
padding: 10px;
}
</style>
</head>
<body>
<table>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
</table>
</body>
</html>
2) The cellpadding attribute specifies the space, in pixels, between the cell wall and the cell content.
The cellspacing, cellpadiing attribute is not supported in HTML5.
syntax:
table cellspacing="50" cellpadding = "10"
end table
<p>Table with cellspacing:</p>
<table cellspacing="50" cellpadding = "10">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
</table>
3) CSS Example To add padding to a table
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
}
th, td {
padding: 10px;
}
</style>
</head>
<body>
<table>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
</table>
</body>
</html>
No comments:
Post a Comment