Want to move a particular div to right

后端 未结 3 1405
生来不讨喜
生来不讨喜 2021-02-01 16:04

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 k

相关标签:
3条回答
  • 2021-02-01 16:40

    This will do the job:

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

    0 讨论(0)
  • 2021-02-01 16:43

    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.

    0 讨论(0)
  • 2021-02-01 16:57

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

    0 讨论(0)
提交回复
热议问题