2013-07-01 43 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