Below are the div elements I have:
.parent {
padding: 10px;
background: grey;
}
.child {
background: green;
display: block;
position: relative;
width: 50px;
}
.stacked {
left: 0px;
}
.three {
left: 200px;
}
<div class="parent">
<div class="child stacked">div1</div>
<div class="child stacked">div2</div>
<div class="child three">div3</div>
</div>
This is how it appears: https://i.sstatic.net/iuyjX.png
I want divs 1 and 2 to stack as they currently do. However, since div3 does not overlap with the above divs, I would like it to be vertically aligned with div 1.
If I change the display property to inline or inline-block, div 2 gets pushed to the right of div one. Additionally, the left values do not align accurately with the parent container. https://i.sstatic.net/skJyh.png
The left values of the divs will be dynamically generated, so predicting if there is overlap between them is challenging.
Is achieving this alignment feasible?