Search code examples
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;
} 

Solution

  • 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.