[TriLUG] Tables and CSS

Scott G. Hall ScottGHall at BellSouth.Net
Mon May 11 12:47:30 EDT 2009


Brian McCullough wrote:
> On Sun, May 10, 2009 at 04:39:46PM -0400, Lucas Myers wrote:
>> try:
>>
>> table { border-collapse: collapse }
> 
> I did, as well as everything else discussed in that section of the CSS
> manual, but nothing seemed to have any effect until I added
> "cellspacing=0" and "cellpadding=0" to the Table tag.
> 
> I may have been getting bitten by caching, but I don't think so.

This is an anomaly mentioned by the CSS Quirks group, and the current
so-called hack is:

table { border-collapse: collapse; }
table, tr, th, td {
   margin: 0px;
   padding: 0px;
   border: 0px;
}

Evidently you have to specify each element to control it from the
default "browser" and "user" style sheets.  Also evidently you have
to specify units in order for IE5+ to pick it up correctly.  Good
luck with IE4 or Netscape-4x.

There is some discussion of this on WebMasterWorld:
http://www.webmasterworld.com/forum83/393.htm
(scroll down to moonbiter's reply of 3:38am Nov.13, 2002)

and on Evolt:
http://lists.evolt.org/archive/Week-of-Mon-20020527/113670.html

But the best explanation is on the Quirks group compatibility pages:
http://www.quirksmode.org/css/tables.html

This is also mentioned in the book "CSS Hacks and Filters: Making
Cascading Stylesheets Work", by Joseph W. Lowery, Wiley (June 10, 2005)
ISBN-13: 978-0764579851

-- 
Scott G. Hall
Raleigh, NC, USA
ScottGHall at BellSouth.Net



More information about the TriLUG mailing list