valign 不在 td 上工作? [英] valign not working on a td?
问题描述
我有一个包含表单的表格,左边的列是字段的名称,我想将文本设置为 td 的顶部,因为目前文本位于底部.
I have a table that contains a form, in the left col is the name of the field, and i would like to set the text to the top of the td, as at the moment the text is at the bottom.
有人知道为什么这是一个命中和未命中元素属性吗?
Does any one know why this is a hit and miss element attribute?
推荐答案
首先,
您真的不应该使用表格进行布局(即使是表单),您应该使用 div
和 CSS:如何在 Internet Explorer 中的全高表格中制作全高单元格
You shouldn't really be using tables for layout (even for forms) you should use div
s and CSS:
how to make full height cell in full height table in Internet Explorer
其次,
valign
已被弃用,我们现在使用 css 属性 vertical-align
看看为什么不使用 valign
:http://phrogz.net/css/vertical-align/index.html
valign
was deprecated, we now use the css property vertical-align
see why not to use valign
:
http://phrogz.net/css/vertical-align/index.html
HMTL:
<div class="className">废话</div>
CSS:
.className {
vertical-align: middle;
}
这篇关于valign 不在 td 上工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!