2011-09-24 75 views
2

我想有一组使用collapse设置的表项,但要从其他组使用separate。我是否必须为每个“区域”制作一张新桌子?我试过了,他们没有排队。当我在我的CSS中的thtd上应用border-collapse时,它们不会一起折叠。表格边框塌陷:混合设置

Ascii艺术时间。

<!-- table with two rows two columns with first one having colspan=2: --> 
┌────────┐ 
| abcd │ 
├───┬────┤ 
| a | bc | 
└───┴────┘ 

<!-- Same table, separate looks like this (but more squished because there arent enough unicode table characters for this) --> 
┌─────────┐ 
| abcd │ 
└─────────┘ <-- this bit is squished together 
┌───┐┌────┐ 
| a || bc | 
└───┘└────┘ 

而我想是这样的,我已经得到了他们是否得到倒塌或不是任意的控制:

<!-- this table is made of two rows. two <td colspan=2> in the first row. four <td> in the second row. The third and fourth ones are to be separate. The rest collapse their borders. --> 
┌────────┬─────────────┐ 
| abcd │  efg  | 
├───┬────┼─────────────┘ <--- again, here the hh and ijk borders should be separate but rising to fill that space 
| | |┌──┐┌───────┐ 
| a | bc ||hh|| ijk | 
| | |└──┘└───────┘  
└───┴────┘ 

在这里你可以看到,我已经得到了HH和IJK为明确separate,但其余的都是collapsed在一起。

将它们放入属于它们自己的表格的区域的问题是表格不再共享对齐。它让事情不再在表格中排列(我怎么能期待它?),但它是一个破坏交易的原因,因为我的数据将不再被组织。

+1

嗯,什么?你将不得不更加具体,或者提供一些视觉例子,因为现在,我不知道你想要什么作为最终结果。 – Nightfirecat

+0

不是很清楚... –

+0

是的。我试图在我的措辞中毫不含糊,但这是一个图片任务。更新 –

回答

0

我敢肯定,这是不可能的表。有人纠正我,如果我错了。
我试过使用margin:cellspacing=但他们都无法正常工作。

0

我认为你最好的选择是使用第二个table

然后,你将需要删除一些边界和使用border-collapse:separate;border-spacing

table{ 
    border-collapse:collapse; 
} 

td{ 
    padding:1em; 
    border:1px solid red; 
    border-collapse:collapse; 
} 

td.no_border{ 
    border-bottom:0; 
    border-right:0; 
    padding:0; 
} 

table.separate{ 
    border-collapse:separate; 
    border-spacing:5px; 
} 

table.separate td{ 
    border-collapse:separate; 
    padding:1em; 
    border-spacing:5px; 
} 

工作实例:http://jsfiddle.net/jasongennaro/k2cN5/

+0

因此,您只需手工捏造间距,直到它看起来不错? –

+0

就是这样@Steven Lu!我认为没有其他办法。 –