2013-07-01 25 views
-2

是否有可能将一张桌面“捕捉”到另一个桌面的底部,同时保留table-bordered功能(例如圆角边缘)。显示了两个表“噼噼啪啪”一起通过Twitter“捕捉”桌子Bootstrap

预期的效果:

Desired effect

圆角不是射门,但你的想法。

+0

你不能简单地设置列的colspan来达到预期的效果吗? – Kami

+0

我确实考虑过这一点,但不幸的是'colspan'在这种情况下并不是理想的效果。如果它是一个宽度“砖砌”的设计,它可能会,但我的列宽在大小上有很大的差异。另外,每次都需要调整'colspan',这可能是一种痛苦,如果桌子真的很大,可能会很乏味! – rybo111

回答

1

据我所知,默认情况下TB中没有这样的东西可用,但没有任何东西阻止您编写自己的CSS,并覆盖TB的样式。这是css的美丽!

如果您使用类似Chrome Inspector的方式检查代码,则可以非常容易地复制应用的TB样式,并将其更改为您的愿望。这正是我所做的,这就是我想出了(没有前缀的!):

table.table-snap { 
    margin-bottom: 0; 
    border-bottom-width: 0; 
} 
table.table-bordered.table-snap:last-child { 
    border-bottom-width: 1px; 
    margin-bottom: 20px; 
} 
.table-bordered.table-snap > thead > tr > th, 
.table-bordered.table-snap > tbody > tr > td, 
.table-bordered.table-snap > tfoot > tr > td, 
.table-bordered.table-snap { 
    border-radius: 0 !important; 
} 
.table-bordered.table-snap:first-child thead:first-child tr:first-child > th:first-child, 
.table-bordered.table-snap:first-child tbody:first-child tr:first-child > td:first-child, 
.table-bordered.table-snap:first-child tbody:first-child tr:first-child > th:first-child, 
.table-bordered.table-snap:first-child { 
    border-top-left-radius: 4px !important; 
} 
.table-bordered.table-snap:first-child thead:first-child tr:first-child > th:last-child, 
.table-bordered.table-snap:first-child tbody:first-child tr:first-child > td:last-child, 
.table-bordered.table-snap:first-child tbody:first-child tr:first-child > th:last-child, 
.table-bordered.table-snap:first-child { 
    border-top-right-radius: 4px !important; 
} 
.table-bordered.table-snap:last-child thead:last-child tr:last-child > th:first-child, 
.table-bordered.table-snap:last-child tbody:last-child tr:last-child > td:first-child, 
.table-bordered.table-snap:last-child tbody:last-child tr:last-child > th:first-child, 
.table-bordered.table-snap:last-child { 
    border-bottom-left-radius: 4px !important; 
} 
.table-bordered.table-snap:last-child thead:last-child tr:last-child > th:last-child, 
.table-bordered.table-snap:last-child tbody:last-child tr:last-child > td:last-child, 
.table-bordered.table-snap:last-child tbody:last-child tr:last-child > th:last-child, 
.table-bordered.table-snap:last-child { 
    border-bottom-right-radius: 4px !important; 
} 

所有你现在需要做的是应用.table-snap类要“捕捉”到它的兄弟姐妹每个表,你应该得到你想要的结果:http://jsfiddle.net/ycTj8/

+0

绝对太棒了!谢谢。 – rybo111