I have two absolute positioned child divs inside a relative positioned div. I am having troubles making the two absolute positioned child divs expandable without overlapping each other. I've tried a variety of different ways already. I also looked at this position absolute but resize parent but I need my child divs to be absolute positioned not relative.
Also this is for mobile to tablet sized browsing so all width's are already 100%.
Edit: I only need .child2 to be expandable in height because .child1 is an image and it will always be 200px in height.
My Sample Code:
<div class="parent">
<div class="child1">
<h2>Client</h2>
<h4>Client Name</h4>
</div>
<div class="child2">
<img src="imageurl" />
</div>
</div>
<div class="parent">
<div class="child2">
<img src="imageurl" />
</div>
<div class="child1">
<h2>Skills</h2>
<h4>Skill Utilized</h4>
</div>
</div>
<div class="parent">
<div class="child1">
<h2>Project URL</h2>
<h4><a href="#">Link to Project</a></h4>
</div>
<div class="child2">
<img src="imageurl" />
</div>
</div>
My Sample CSS:
.parent {
position: relative;
width: 100%;
height: auto;
}
.child1 {
position: absolute;
top: 50px;
width: 100%;
height: 200px;
}
.child2 {
position: absolute;
top: 250px;
width: 100%;
height: auto;
}