如何垂直对齐a<;输入>;及<;iframe>;内部a<;td>;?

如何垂直对齐a<;输入>;及<;iframe>;内部a<;td>;?,iframe,input,valign,Iframe,Input,Valign,我尝试将valign=“top”作为的属性,但没有成功 <tr> <td> <span class="validationInline">*</span> Security Code: </td> <td valign="top"> <input type="text" /> <iframe scrolling="no" height="21px" frameborder="

我尝试将valign=“top”作为
的属性,但没有成功

<tr>
<td>
    <span class="validationInline">*</span>
    Security Code:
</td>
<td valign="top">
    <input type="text" />
    <iframe scrolling="no" height="21px" frameborder="0" width="62px" marginheight="0" marginwidth="0" src="http://google.com"></iframe>
</td>
</tr>

*
安全代码:
似乎
与按钮对齐,而
与顶部对齐。


<td valign="top"><input type="text" />
  <iframe scrolling="no" height="18" frameborder="0" width="62" marginheight="0" marginwidth="0" src="http://google.com"> </iframe></td>

以上是我的作品。。。它将内容与单元格顶部对齐。这就是您要找的吗?

从您的描述来看,单元格似乎与顶部对齐,但输入/iframe在底部彼此对齐。垂直对齐通常仅适用于同级元素

您需要做的是在输入和iframe上设置CSS
vertical align:top
属性

<td valign="top">
  <input style="vertical-align:top" type="text" />
  <iframe style="vertical-align:top" scrolling="no" height="18" frameborder="0" width="62" marginheight="0" marginwidth="0" src="http://google.com"> </iframe>
</td>


您可以发布整个表格或至少整行的HTML吗?它与您的代码片段完全相同。不,我要求您提供表格的其余部分,或至少是行的其余部分。。。重新阅读您的问题,您遇到的确切问题是什么?我已将整行粘贴在此处。我会将其进一步清理,或者将其设置为
社区wiki
,这样我们就可以在不重新发布的情况下对其进行改进。