通常<tr>
應該沒有造型,特別是如果它不是由<td>
S,邊框繼承和利潤率是什麼<tr>
不是應該有一個例子。
您的問題,最簡單的方法是添加<div>
S中<td>
的內線和他們的風格相反,你可以使用這樣的事情:
HTML:
<table>
<tr>
<td>
<div>santiago</div>
</td><td>
<div>santiago</div>
</td><td>
<div>santiago</div>
</td>
</tr><tr>
<td>
<div>santiago</div>
</td><td>
<div>santiago</div>
</td><td>
<div>santiago</div>
</td>
</tr>
</table>
CSS:
table {
/* to eliminate the default spacing between TDs*/
border-collapse: collapse;
}
td {
/* let the divs do the spacing */
padding: 0;
}
td div {
border-style: solid;
border-color: black;
border-width: 1px 0;
/* now, here you can add the margin */
margin-bottom: 10px;
/* just some nice padding, you don't really need this */
padding: 10px;
}
td:first-child div {
/* just side borders on first and last elements */
border-left-width: 1px;
}
td:last-child div {
/* just side borders on first and last elements */
border-right-width: 1px;
}
小提琴:https://jsfiddle.net/dow267ec/
更新:如果內容是不同高度的,你不能固定高度添加到所有的div,你可以添加這個簡單的JS你旁邊的桌子,你應該罰款。同樣,我仍然recommendt列(見zurb基礎)的方式,但有時你必須做出這些表的工作。
document.querySelectorAll("table tr").forEach(function(tr){
var max = 0, divs = tr.querySelectorAll("td > div");
divs.forEach(function(div){ max = Math.max(div.offsetHeight, max); });
// 10 is the padding that we had.
divs.forEach(function(div){ div.style.height = (max - (2 * 10)) + "px"; });
});
這裏是更新的小提琴與此js啓用。您可以添加一個id表,以避免撞到其他表。 https://jsfiddle.net/dow267ec/2/
TR {顯示:塊; margin-bottom:5px;} –
請提供[mcve] –
@GCyrillus是的,我試過了。但是我不需要表頭中的行之間的空間,只在體內。 – Eugene