XML technologies / CSS / CSS Cookbook / Tables / Setting cell spacing
(Excerpt from “CSS Kochbuch” by Christopher Schmitt)
Problem
You want to set the gaps between the table border and the borders of individual cells.
Solution
Use the table attribute cellspacing:
<table cellspacing="15">
<tr>
<th colspan="2">Tabelle 1. Allgemeine statistische Angaben</th>
</tr>
<tr>
<th></th>
<th>Geschätzt</th>
</tr>
<tr>
<td>Gesamtbevölkerung</td>
<td>272.091</td>
</tr>
</table>Discussion
The CSS 2.1 specification describes a standard mechanism for manipulating the table attribute cellspacing. If the property border-collapse has the value separate, the property border-spacing can also be used:
border-collapse: separate;
border-spacing: 15px;Unfortunately, this part of the specification is not implemented in Internet Explorer 6 for Windows, although it is in Firefox and Netscape Navigator 7+. Using the attribute cellspacing is therefore currently the best solution that also works in Internet Explorer for Windows.
See also
The recipes Setting cell borders and padding and Removing gaps between table cells for setting cell borders and padding, and
the CSS 2.1 specification for the properties
border-collapseandborder-spacing.
Copyright of the German edition © 2007 by O’Reilly Verlag GmbH & Co. KG
You may print the online version for your private use.
Otherwise, this chapter from “CSS Kochbuch” is subject to the same conditions as the bound edition: the work, including all its parts, is protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
O’Reilly Verlag GmbH & Co. KG, Balthasarstr. 81, 50670 Köln