Sorry if this question has been answered already, I've searched and was unable to find an answer.
I'm having an issue keeping an absolutely positioned element inside of it's parent element.
For example, the following works without the parent having a display: inline;
<div class="container">
<div class="bottom">...</div>
<div class="top">...</div>
</div>
<div class="container">
...
</div>
and
.container {
position: relative;
}
.bottom {
position: relative;
z-index: 998;
}
.top {
position: absolute;
top: 0;
left: 0;
z-index: 999;
}
Obviously, the container elements will be displayed on top of each other vertically whereas the intent is to have them side by side. Adding display:inline;
to the #container
element "fixes" this by displaying the container elements side by side.
However, when display:inline;
is added to the parent, it causes the .top
element that has position:absolute;
to lose it's alignment and to appear below the intended location. I feel that I'm doing something wrong that is fairly simple, but I'm stumped. Any help or direction is extremely appreciated.