考虑下面的例子: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