HTML and CSS Reference
In-Depth Information
A table that uses
the border-col-
lapse property to
eliminate space
between cells.
The table that I used for this example included the border
attribute to create a border. If you apply table borders using CSS,
they will override the border attribute, so you don't need to
remove it. This can be helpful because primitive browsers (includ-
ing the browsers on some mobile phones) don't offer CSS sup-
port, and including the border attribute will ensure that borders
are still displayed.
Cell Padding
The cell padding attribute defines the amount of space between the edges of the cells and
the content inside a cell. By default, many browsers draw tables with a cell padding of
two pixels. You can add more space by adding the cellpadding attribute to the <table>
element, with a value in pixels for the amount of cell padding you want.
Here's the revised code for your <table> element, which increases the cell padding to
10 pixels. The result is shown in Figure 10.10.
<table cellpadding=“10” border=“1”>
FIGURE 10.10
A table with the
cell padding set to
10 pixels.
Search WWH ::

Custom Search