How to position an HTML element on top of another element without affecting the layout of the element(s) beneath?

后端 未结 3 940
野趣味
野趣味 2021-01-05 21:44

Generally speaking, HTML layout is flow-based. Each element gets positioned after the one before it, either to the right of it or beneath it. There are plenty of exception

3条回答
  •  情话喂你
    2021-01-05 22:26

    If I understand it correctly you need to use offset properties together with position:absolute.

    The absolute position takes your image out of the flow, the offset can give you the position of the element you want to overlay (the TD in your question).

    Having the offset (px from left and top of the page for the TD) you can the move the image to the correct position.

    Look here: http://jsfiddle.net/jrUsM/

    jQuery documentation explains it very well.

提交回复
热议问题