position relative and right property

前端 未结 3 1471
攒了一身酷
攒了一身酷 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:28

    There's a way to make it work to a relative.

    One way is first to set the parent of the display to inline-flex.

    Next, set the element (child) position:relative; margin-left:auto; right:0;.

提交回复
热议问题