Position absolute and overflow hidden
An absolutely positioned element is actually positioned regarding a relative
parent, or the nearest found relative parent. So the element with overflow: hidden
should be between relative
and absolute
positioned elements:
<div class="relative-parent">
<div class="hiding-parent">
<div class="child"></div>
</div>
</div>
.relative-parent {
position:relative;
}
.hiding-parent {
overflow:hidden;
}
.child {
position:absolute;
}
Make outer <div>
to position: relative
and inner <div>
to position: absolute
. It should work for you.
What about position: relative
for the outer div? In the example that hides the inner one. It also won't move it in its layout since you don't specify a top or left.