HTML Table Cellspacing Attribute

The cellpadding and cellspacing is often used togather as attributes of table container but keep in mind the purpose of both tags are different.As discussed in previous tutorial cellpadding add spaces between the cell boundaries and cell data whereas cellspacing add the white space between the table cells. The least or minimum space that you can add between the cells is zero.

The HTML code for setting the cellspacing is shown below.

<html>
<body>
<table border="1">
<h3> Table without cellspacing </h3>
<tr>
<td>
Student Name
</td>
<td>
Student Marks
</td>
</tr>
<tr>
<td>
Adam
</td>
<td>
80
</td>
</tr>
</table>
<table border="1" cellspacing="20">
<h3> Table with cellspacing </h3>
<tr>
<td>
Student Name
</td>
<td>
Student Marks
</td>
</tr>
<tr>
<td>
Adam
</td>
<td>
80
</td>
</tr>
</table>
</body>
<html>
 

The result of HTML code will appear on browser like this:

image

Tags: , , , ,

Author: Revo

Share This Post On

Submit a Comment

Your email address will not be published. Required fields are marked *

10 − three =

 

Pin It on Pinterest

Shares
Share This