I have three divs with class "row". Inside of row2 I have two divs with class "layer". I'm trying to set Layer1 and Layer2 on top of eachother, however, when setting them to position:absolute the parent's collapses. Due to the nature of using position:absolute. How can I prevent this from happening?
I've tried the solutions from this thread: How do you keep parents of floated elements from collapsing?
With no success, and I've also tried the "Clearfix" but that doesn't work either.
Code:
HTML
<div id="row1" class="row">
<div id="row2" class="row">
    <div id="layer1" class="layer">
    <div id="layer2" class="layer">
</div>
<div id="row3" class="row">
CSS
.row::after 
{
    content: "";
    clear: both;
    display: block;
}
.layer
{
    position: absolute;
}
.layer::after 
{
    content: "";
    clear: both;
    display: block;
}

 
     
     
    