HTML and CSS Reference
In-Depth Information
Figure 5-23
Cell padding values
Setting Cell Spacing and Cell Padding with HTML
• To define the space between table cells, add the
cellspacing
attribute
<table cellspacing=”
value
”> ... </table>
to the
table
element, where
value
is the space between table cells in pixels.
• To define the padding within table cells, add the
cellpadding
attribute
<table cellpadding=”
value
”> ... </table>
to the
table
element, where
value
is the size of the padding space in pixels.
Kyle would like you to experiment with how the
cellpadding
and
cellspacing
attributes might affect the appearance of the program schedule, so you'll add these two
attributes to the
table
element, setting the cell spacing to 3 pixels and the cell padding
to 5 pixels.
To set the cell spacing and cell padding:
◗
1.
Return to the
schedule.htm
file in your text editor.
◗
2.
Within the opening
<table>
tag, insert the following attributes, as shown in
Figure 5-24:
cellspacing=”3” cellpadding=”5”
Figure 5-24
Setting the cell spacing and padding values
space betwe
en
cells in pixels
space within
cells in pixels
◗
3.
Save your changes to the file and then reopen
schedule.htm
in your Web
browser. As shown in Figure 5-25, the spaces between and within the table cells
have increased from their default values.