position relative and right property

前端 未结 3 1472
攒了一身酷
攒了一身酷 2021-01-11 18:10

I always thought by setting the div to relative and right 0 would position the div all the way to the right, if its parent was 100% width. Apparently I\'m wrong and only abs

3条回答
  •  攒了一身酷
    2021-01-11 18:27

    So is there no way to make it work with relative?

    Correct. Relative positioning is the position offset from where it would be with static positioning.

    You need absolute positioning to position with respect to the edges of the containing block.

提交回复
热议问题