如何垂直对齐 和
我尝试将 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>
似乎 将自身与按钮对齐,而
与顶部对齐。
I've tried putting valign="top" as attribute of <td>
but in vain.
<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>
It seems that <input>
aligns itself to the buttom,while <iframe>
to the top.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从您的描述来看,单元格似乎与顶部对齐,但输入/iframe 在底部彼此对齐。垂直对齐通常只适用于同级元素。
您需要做的是在输入和 iframe 上设置 CSS
vertical-align:top
属性。From your description it seems that the cell is aligning to the top, but the input/iframe are aligning to each other at the bottom. Vertical alignment generally only applies to sibling elements.
What you'll need to do is set the CSS
vertical-align:top
property on both the input and iframe.上面的内容对我有用...它将内容与单元格的顶部对齐。这就是你所追求的吗?
The above works for me... It aligns the content to the top of the cell. Is this what you're after?