George and Susan Welcome to our HTML help page!
Home | HTML-Index | Basic HTML | HTML Structure

CHANGE CELL SPACING AND CELL PADDING



The CELLSPACING and CELLPADDING attributes are often used to improve the layout and readability of a table.

The CELLSPACING attribute lets you change the amount of space between each cell in a table. Changing the cell spacing will change the size of the boarder between cells. Specify the amount of space you want to use in pixels. By default, tables display a cell spacing of 2 pixels.

The CELLPADDING attribute lets you change the amount of space around the content of each cell in a table, increasing the cell padding can make the table appear less cluttered. By default the cell padding for a table is 1 pixel.

CELLSPACING
Type this:
down
<TABLE BORDER=2 WIDTH="75%"CELLSPACING="10"ALIGN=CENTER>
<TR VALIGN=TOP>
<TH ROWSPAN=3>George's Products</TH>
        <TH>Product Name</TH>
        <TH>Price per unit</TH>
        <TH>Units Available</TH>
</TR>
<TR>
        <TD>Art Print</TD>
        <TD>$9.99</TD>
        <TD>40</TD>
</TR>
<TR>
        <TD>Books</TD>
        <TD>$3.99</TD>
        <TD>75</TD>
</TR>
</TABLE>


And you get the following:
down
George's Products Product Name Price per unit Units Available
Art Print $9.99 40
Books $3.99 75





CELLPADDING
Type this:
down
<TABLE BORDER=2 WIDTH="75%"CELLPADDING="10"ALIGN=CENTER>
<TR VALIGN=TOP>
        <TH ROWSPAN=3>George's Products</TH>
        <TH>Product Name</TH>
        <TH>Price per unit</TH>
        <TH>Units Available</TH>
</TR>
<TR>
        <TD>Art Print</TD>
        <TD>$9.99</TD>
        <TD>40</TD>
</TR>
<TR>
        <TD>Books</TD>
        <TD>$3.99</TD>
        <TD>75</TD>
</TR>
</TABLE>


And you get the following:
down
George's Products Product Name Price per unit Units Available
Art Print $9.99 40
Books $3.99 75


My home page
Back to Top