考慮下面的例子:http://jsfiddle.net/upsidown/z4m7r/表垂直對齊的webkit問題
HTML:
<table class="main-table" cellspacing="20">
<tr>
<td style="height:100%;"><table class="sub-table"><tr><td>Some text</td></tr><tr><td class="bottom-align">Some bottom aligned element</td></tr></table></td>
<td>Some very long text. Some very long text. Some very long text. Some very long text. Some very long text. Some very long text. </td>
<td>Some other text</td>
</tr>
</table>
CSS:
.main-table {
width:300px;
vertical-align: top;
}
.main-table td {
vertical-align: top;
}
.sub-table {
height:100%;
}
td {
border:2px solid black;
}
td.bottom-align {
vertical-align: bottom;
background:yellow;
}
黃色的單元格文本應該在底部垂直對齊。這適用於Firefox,但不適用於Safari/Chrome(webkit)瀏覽器。
任何想法如何實現這一目標?提前致謝。
我不能相信我錯過了表沒有高度設置的事實。 – Jake 2013-03-05 14:57:16