HTML and CSS Reference
In-Depth Information
A cellpadding attribute with a value of 0 causes the edges of the cells to touch the
edges of the cell's contents. This doesn't look good when you're presenting text, but it
can prove useful in other situations.
You can also specify the padding of a table cell using the padding property in CSS. The
advantages of doing so are that you can specify the padding for the top, left, right, and
bottom separately, and that you can specify different padding amounts for different cells
of the table if you choose to do so. For example, you can set the padding of header cells
to 10 pixels on the top and 5 pixels on the sides and bottom, and then set the padding to
four pixels on all for sides for regular table cells.
Cell Spacing
Cell spacing is similar to cell padding except that it affects the amount of space between
cells—that is, the width of the space between the inner and outer lines that make up the
table border. The cellspacing attribute of the <table> element affects the spacing for
the table. Cell spacing is two pixels by default.
Cell spacing also includes the outline around the table, which is just inside the table's
border (as set by the border attribute). Experiment with it, and you can see the differ-
ence. For example, Figure 10.11 shows our table with cell spacing of 8 and a border of 4,
as shown in the following code:
Input
<table cellpadding=“10” border=“4” cellspacing=“8”>
.
Output
FIGURE 10.11
How increased cell
spacing looks.
 
 
Search WWH ::




Custom Search