垂直对齐html表单 [英] vertical align html form
本文介绍了垂直对齐html表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望将此文本框居中放置,并在页面上垂直和水平放置提交"按钮,但是以下代码只是将其放在顶部居中.如何将其居中放置在页面上?就像忽略了垂直对齐设置一样.
I'm looking to center this textbox and submit button on the page both vertically and horizontally but the following code just puts it in the top center. How can I center this to the page? It's like it's ignoring the vertical-align setting.
<div style="text-align:center; vertical-align:middle">
<form action="save_thought.php" method="post">
<input type="text" name="thought"><br>
<input type="submit" value="Submit">
</form>
</div>
推荐答案
您可以使用 position:absolute
DEMO http://jsfiddle.net/kevinPHPkevin/U8dZr/
You can use position:absolute
DEMO http://jsfiddle.net/kevinPHPkevin/U8dZr/
div#form-wrapper {
position:absolute;
top:50%;
right:0;
left:0;
}
这篇关于垂直对齐html表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文