How to position element below relative positioned element without overlapping?

五迷三道 提交于 2019-12-05 07:04:48

absolute positioning takes the element out of the flow of the structure. It's presence is ignored for this reason, it's what it's purpose is. If you need an element positioned left or right then use float

When floating elements ensure you clear the bottom of the div so then the layout is preserved

<div style="clear:both;"></div>

DEMO http://jsfiddle.net/kevinPHPkevin/uHuSF/

Otherwise a different approach is required to accomplish your goal.

Since you've applied position:relative to your very first element either you've to specify the height or provide padding-bottom to it.

For instance, in your provided code I've applied height of 20px to it.

Note: Using height is better than using padding-bottom for this kind of scenario

<div style="position: relative; height: 20px;">
    <div style="position:absolute;">blabla</div>
</div>
<div>I WANT THIS BELOW</div>
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!