Difference between the CELLSPACING and CELLPADDING.

Q15. Explain the difference between the CELLSPACING and CELLPADDING attributes of the <TABLE> tag with the help of an example.

Ans. The CELL PADDING attribute allows the amount of space, in pixels, between the edges of a cell and its content. On the other hand, the CELLSPACING attribute allows the amount of space, in pixels, between the borders of cells of a table.

Example for CELLSPACING and CELLPADDING attributes:

<HTML>

<HEAD>

<TITLE> CELLSPACING and CELLPADDING attributes

</TITLE>

</HEAD>

<BODY>

<TABLE BORDER=”4″ CELLPADDING=”10″ CELLSPACING=”8″>

<TR>

<TD>NAME </TD>

<TD>ROLL_NO </TD>

<TD>ADDRESS</TD>

<TD>MARKS </TD>

</TR>

<TR>

<TD>DIVYA </TD>

<TD> 101 </TD>

<TD>PREET VIHAR</TD>

<TD> 84</TD>

</TR>

<TR>

<TD>KAVYA </TD>

<TD> 102 </TD>

<TD> LAXMI NAGAR</TD>

<TD>86 </TD>

</TR>

</BODY>

</HTML>

Leave a Reply

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

%d bloggers like this: