CSS overflow hidden with absolute position

前端 未结 3 1852
谎友^
谎友^ 2020-11-30 03:32

I\'ve been banging my head on this one. I want to absolute position an image that I will be moving around in a div and want anything that extends outside the div to be clipp

3条回答
  •  生来不讨喜
    2020-11-30 04:19

    Try adding position: relative to your outer div. This will position the image relative to that div (honoring the overflow style) instead of relative to the page.

    Example:

    
    
      
    On top of image.

    See it on JS Bin

提交回复
热议问题