Text in absolutely positioned div is overlapping

后端 未结 2 1435
清歌不尽
清歌不尽 2021-01-28 07:50

In the below code snippet, the div elements (.main > div) are relatively positioned and are floated left.

Because of the relative positioning, the div elements (.main >

2条回答
  •  Happy的楠姐
    2021-01-28 08:16

    The reason is that each of your position:absolute; elements are removed from the DOM's native flow, and positioned absolutely to their parent element. Since they both have the same positioning, they are placed over top of each other. Use position:relative to position the elements relative to their native position in the DOM.

提交回复
热议问题