CSS: How to position two elements on top of each other, without specifying a height?

后端 未结 9 1279
走了就别回头了
走了就别回头了 2020-12-22 21:37

I have two DIVs that I need to position exactly on top of each other. However, when I do that, the formatting gets all screwed up because the containing DIV acts like there

9条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-22 22:16

    Due to absolute positioning removing the elements from the document flow position: absolute is not the right tool for the job. Depending on the exact layout you want to create you will be successful using negative margins, position:relative or maybe even transform: translate. Show us a sample of what you want to do we can help you better.

提交回复
热议问题