Force “position: absolute” to be relative to the document and not the parent container

前端 未结 5 1376
遥遥无期
遥遥无期 2020-12-08 12:34

I am trying to insert a div into any part of the body and make its position: absolute relative to the whole document and not a parent element which has a

5条回答
  •  生来不讨喜
    2020-12-08 13:28

    This isn't possible with simply CSS and HTML.

    Using Javascript/jQuery you could potentially get the elements jQuery.offset() to the DOM and compare it the jQuery.position() to calculate where it should appear on the page.

提交回复
热议问题