将按钮向右对齐 [英] Place a button right aligned
本文介绍了将按钮向右对齐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用此代码右对齐按钮。
I use this code to right align a button.
<p align="right">
<input type="button" value="Click Me" />
</p>
但是P标签浪费了一些空间,所以要使用span或div。 >
But P tags wastes some space, so looking to do the same with span or div.
推荐答案
您使用的对齐技术取决于您的情况,但基本的是 float:right;
:
Which alignment technique you use depends on your circumstances but the basic one is float: right;
:
<input type="button" value="Click Me" style="float: right;">
你可能想清除你的浮动,但可以用 overflow:hidden
在父容器或显式< div style =clear:both;>< / div>
You'll probably want to clear your floats though but that can be done with overflow:hidden
on the parent container or an explicit <div style="clear: both;"></div>
at the bottom of the container.
例如: http://jsfiddle.net / ambiguous / 8UvVg /
这篇关于将按钮向右对齐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文