Why is an absolutely positioned element placed by its sibling instead of at the top corner of the page?

前端 未结 2 860
挽巷
挽巷 2021-01-24 00:26

I don\'t understand why my absolutely positioned element appears after my child_static div. I always thought that absolutely positioned elements are taken out of th

2条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-24 00:41

    You forgot to set from which sides your DIV is positioned.

    Something like:

    top: 0;
    left: 0;
    

    http://jsfiddle.net/Paf_Sebastien/uqprmkwo/

    (I changed the 2nd DIV dimensions so you can see both.)

提交回复
热议问题