Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

html - valign not working on a 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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Firstly,

You shouldn't really be using tables for layout (even for forms) you should use divs and CSS: how to make full height cell in full height table in Internet Explorer

Secondly,

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">Blah</div>

CSS:

.className {
   vertical-align: middle;
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...