【问题标题】:How to vertical align <input> and <iframe> inside <td>?(demo included)如何在 <td> 中垂直对齐 <input> 和 <iframe>?(包括演示)
【发布时间】:2010-11-22 20:57:39
【问题描述】:
这里的页面很简单:
http://maishudi.com/test.php
代码:
<table>
<tr>
<td valign="top">
<input type="text" />
<iframe scrolling="no" height="21px" frameborder="0" width="62px" marginheight="0" marginwidth="0" src="Server/SecCode.php">
</iframe>
</td>
</tr>
</table>
(来源:maishudi.com)
【问题讨论】:
标签:
html-table
vertical-alignment
【解决方案1】:
使用 td 标签的 valign 属性。
..
<td valign="top">
</td>
编辑:
试试这个,
<table>
<tr>
<td><input type="text" /></td>
<td><iframe scrolling="no" height="21px"
frameborder="0" width="62px" marginheight="0" marginwidth="0"
src="http://maishudi.com/Server/SecCode.php">
</iframe>
</td>
</tr>
</table>
【解决方案2】:
使用两个 td,一个用于输入,一个用于 iframe:
或者根本不使用表格,使用 CSS 定位项目,使用 float 属性: