[css] Want to move a particular div to right

I want to move a particular div more to the right side so that the div in the left gets some more space to display the contents in it.

I tried few things in CSS, but I know I am doing something wrong.

In CSS, I have...

login-box {
    width: 200px;
    margin-left: 50px;
} 

This question is related to css

The answer is


You can use float on that particular div, e.g.

<div style="float:right;">

Float the div you want more space to have to the left as well:

<div style="float:left;">

If all else fails give the div on the right position:absolute and then move it as right as you want it to be.

<div style="position:absolute; left:-500px; top:30px;"> 

etc. Obviously put the style in a seperate stylesheet but this is just a quicker example.


This will do the job:

_x000D_
_x000D_
<div style="position:absolute; right:0;">Hello world</div>
_x000D_
_x000D_
_x000D_


For me, I used margin-left: auto; which is more responsive with horizontal resizing.