Position DIV relative to another DIV?

前端 未结 4 2143
既然无缘
既然无缘 2020-12-08 04:39

Is it possible to position a DIV relative to another DIV? I imagine this can be done by first placing it inside of the reference DIV, and then using position: relative

4条回答
  •  死守一世寂寞
    2020-12-08 04:50

    First set position of the parent DIV to relative (specifying the offset, i.e. left, top etc. is not necessary) and then apply position: absolute to the child DIV with the offset you want.
    It's simple and should do the trick well.

提交回复
热议问题