Adjusting Cellpadding and Cellspacing

Normally, when you create a layout table, you set the table tag's cellpadding and cellspacing attributes to 0. But when you build a data table, cellpadding and cellspacing are useful formatting tools. Cellpadding determines the amount of interior whitespace between the edges of a table cell and its content, while cellspacing determines the amount of exterior whitespace between individual table cells.

When you set the cellpadding and cellspacing attributes in the table tag, their values apply to every cell in the table:

<table border="1" cellpadding="5" cellspacing="8">

Figure 56.3 shows a table with exactly these attributes. Compare it with the table in Figure 56.2 to see the difference in appearance that ...

Get Web Design Garage now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.