XML technologies / CSS / CSS Cookbook / Tables / Removing gaps between table cells
(Excerpt from “CSS Kochbuch” by Christopher Schmitt)
Problem
You want to remove the gaps between individual cells.
Solution
Set the property border-collapse to the value collapse:
#shoppingcartTable {
border-collapse: collapse;
width: 100%;
border: 1px solid #666;
}
#shoppingcartTable th {
background: #888 url(th_bkgd.jpg) repeat-x;
font: italic 1.5em Georgia, "Times New Roman", Times, serif;
padding: .5em 0 .5em 7px;
text-align: left;
border-top: 1px solid #666;
border-bottom: 1px solid #666;
text-shadow: #ccc -2px 2px -2px;
}Discussion
Using the value collapse for the property border-collapse removes the gaps between table cells. If you now define cell borders, you get a line spanning the entire row or column.
See also
See the recipe Setting cell borders and padding for a detailed discussion of the collapsed border model.
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