Div with scroll and content with absolute positions

后端 未结 8 1046
小鲜肉
小鲜肉 2020-12-23 16:54

I have a \"div\" with style: overflow-y: scroll; overflow-x: auto; I try to dynamicaly add image inside this \"div\" with absolute or relative position. Everyth

8条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-23 17:48

    The declaration position: absolute; means that the element will be displayed relative to the view-port's upper left corner. Using relative instead means that the values you use for left and top will be added to wherever the img would have been normally.

提交回复
热议问题