将按钮对准中心 [英] Aligning a button to the center
本文介绍了将按钮对准中心的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个简单的提交按钮。我想把它对准中心。这是我的代码:
I have a simple submit button. I am wanting to align it to the center. Here is my code:
<input type="submit" name="btnSubmit" value="Submit" onClick="Submit" align="center">
但是,它不工作。
感谢
推荐答案
p>您应该使用这样的:
You should use something like this:
<div style="text-align:center">
<input type="submit" />
</div>
或者你可以使用这样的东西。通过给元素一个宽度,并为左和右边距指定 auto
,元素将以其父元素为中心。
Or you could use something like this. By giving the element a width and specifying auto
for the left and right margins the element will center itself in its parent.
<input type="submit" style="width: 300px; margin: 0 auto;" />
这篇关于将按钮对准中心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文