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;">
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.
For example: http://jsfiddle.net/ambiguous/8UvVg/
Floated elements are removed from the normal document flow so they can overflow their parent's boundary and mess up the parent's height, the clear:both
CSS takes care of that (as does overflow:hidden
). Play around with the JSFiddle example I added to see how floating and clearing behave (you'll want to drop the overflow:hidden
first though).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…