Div with scroll and content with absolute positions

后端 未结 8 969
小鲜肉
小鲜肉 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条回答
  •  囚心锁ツ
    2020-12-23 17:47

    Try float:left or float:right with margin

    I got the same issue in chrome with position:absolute in a overflow-y: auto;. The divs were getting fixed in there positions- while scrolling.

    And a simple solution is using float.

    my old code was-

    position:absolute; right:10px;
    

    and I replaced with the following and it worked-

    float:right; margin-right:10px;
    

提交回复
热议问题