Absolute positioning with percentages giving unexpected results

前端 未结 3 528

Please consider this jsfiddle, containing this html code:

TEST

A

3条回答
  •  醉酒成梦
    2021-02-05 10:15

    The absolute positioning is applied relative to the next parent element whose position is not static. In your case, that's the full page. Try setting position: relative on the container division.
    See the jsFiddle.

    See: W3C - 10.1 - Definition of "containing block"

提交回复
热议问题