【发布时间】:2011-04-11 18:02:09
【问题描述】:
我无法让 td 在其顶部有一些文本并在其底部有一个图像按钮。这是类似于我现在的代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head></head>
<body>
<table border="1">
<tr>
<td valign="top" style="padding:0; height:100%">
Some text
<form style="vertical-align: bottom;">
<input type="submit" value="should be at bottom of td"/>
</form>
</td>
<td>
This <br />
This <br />
This <br />
This <br />
This <br />
This <br />
This <br />
This <br />
This <br />
This <br />
This <br />
This <br />
</td>
</tr>
</table>
</body>
</html>
从技术上讲,我可以通过将第一个 <td> 分成 2 行并在另一个 <td> 上使用 rowspan="2" 来实现我想要的,但我想避免这种情况,因为它不直观,我认为它是黑客。另外,我只需要支持最新版本的 FF 和 Chrome。有什么想法吗?
P/S:我 am 在这里处理表格数据,所以请不要“你不应该使用表格!”一种建议。
更新:添加了 DocType 和浏览器支持要求。
【问题讨论】:
标签: html css html-table cell