I use this code to right align a button.
<p align="right">
<input type="button" value="Click Me" />
</p>
But <p> tags wastes some space, so looking to do the same with <span> or <div>.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Which alignment technique you use depends on your circumstances but the basic one is
float: right;:You’ll probably want to clear your floats though but that can be done with
overflow:hiddenon 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:bothCSS takes care of that (as doesoverflow:hidden). Play around with the JSFiddle example I added to see how floating and clearing behave (you’ll want to drop theoverflow:hiddenfirst though).