20021229 Sunday December 29, 2002

CSS and border-collapse property I can't seem to get the border-collapse property to work on my tables. Basically, I should be able to specify a border and border-collapse: collapse on a table and this border will be applied to all cells. But I can't get it to work - any ideas? Here's an example:

<table width="300" 
  style="border: 1px solid black; border-collapse: collapse">
  <tr>
    <th>&nbsp;</th>
  </tr>
  <tr> 
    <td>this cell should have a top border<td>
  </tr>
</table>

And here's that same table without the HTML escaped:

 
this cell should have a top border

Posted in The Web at Dec 29 2002, 06:58:14 AM MST 3 Comments

Comments:

I could be mistaking but by my understanding you are asking too much from the border-collapse style. I think you still have to define the border on the cells. Try this for example :
<table width="300" border="0" style="border-collapse: collapse"> <tr> <th style="border: 1px solid black">&amp;nbsp;</th> </tr> <tr> <td style="border: 1px solid black">this cell should have a top border</td> </tr> </table> If I'm wrong, I hope someone will correct me.

Posted by Danman on December 29, 2002 at 03:32 PM MST #

Note that if you need the same border for all cells you better put the border style into the <tr> tag

Posted by Danman on December 29, 2002 at 03:42 PM MST #

Yeah, I've done it on the cells to get my desired behavior, but I swear that I've seen this work where there's only one border defined, and it "collapses" onto all the cells. Maybe it works with XHTML compliance turned off or something.

Posted by Matt Raible on December 29, 2002 at 08:44 PM MST #

Post a Comment:
  • HTML Syntax: Allowed
Click me to subscribe
Matt Raible is a Web Architect who enjoys developing applications with open source technologies. Contact me for rates.
« December 2008
SunMonTueWedThuFriSat
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
   
       
Today

Recent Entries

Tag Cloud