[thelist] CSS Table Borders not working (<col>,<colgroup>)

James Aylard webmaster at equilon-mrc.com
Thu Apr 26 10:35:46 CDT 2001


Mark,

> Can someone please explain why the css borders for this very simple table
> aren't working?? I've applied the styles to <col> and <colgroup> tags.

    The "cell-spacing" property is not a part of any approved W3C
recommendation. It had been included in a CSS 2 draft recommendation [1],
but was replaced in the final recommendation in favor of "border-spacing"
[2] (are you referencing the latest version of the CSS 2 recommendation
[3]?). Additionally, Internet Explorer does not support "border-spacing"
(I'm not sure whether Netscape 6.x does). To achieve collapsed borders, use
the "border-collapse" property [4] with a value of "collapse" on your table
element (this will work in IE 5+, and I believe in Netscape 6).
    Also, Internet Explorer does not support the border-style value of
"hidden" [5], nor borders on either the <col> or <colgroup> elements [6, 7].
    And in your Netscape 6 section, some of your code is badly formed,
lacking a space between your style attribute value and the colspan
attribute:

  <th style="border: thin solid"colspan="2">First</th>
  <th style="border: thin solid"colspan="2">Second</th>

    Be sure to refer to Microsoft's HTML [8] and CSS [9] references for a
thorough understanding of which versions of Internet Explorer support which
CSS properties and property values, which should prevent a lot of headaches.
Unfortunately, Netscape [10] and Opera [11] documentation is fairly sketchy,
and will require trial-and-error as much as anything else.

hth,
James Aylard

1.
http://www.w3.org/TR/1998/WD-css2-19980128/tables.html#propdef-cell-spacing
2.
http://www.w3.org/TR/1998/REC-CSS2-19980512/tables.html#propdef-border-spaci
ng
3. http://www.w3.org/TR/REC-CSS2/
4. http://www.w3.org/TR/REC-CSS2/tables.html#propdef-border-collapse
5.
http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/borderS
tyle.asp
6.
http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/COLGROUP.a
sp
7. http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/COL.asp
8. http://msdn.microsoft.com/workshop/author/css/reference/attributes.asp
9. http://msdn.microsoft.com/workshop/author/html/reference/elements.asp
10. http://developer.netscape.com/evangelism/docs/references/
11. http://www.opera.com/opera5/specs.html





More information about the thelist mailing list