I am using flexbox to get the height of the parents to be the same (need them to match) and flex-wrap
to wrap every 3.
I then have a button that is always going to be at the bottom.
The first child will always have different sized heights, but always the same width.
Now the trick is, I want child 2 to be at the bottom on top of the button and have both clear the content of child 1.
Absolute positioning will not clear the text of child 1.
I tried flex-grow
, but it didn't work for me, maybe because I am new to flexbox.
Please look at the fiddle: https://jsfiddle.net/mm783qc6/4/
.contain {
display: flex;
border: 1px solid #000;
width: 100%;
flex-wrap: wrap;
}
.p {
width: 29.5%;
float: left;
position: relative;
margin: 0 10px 30px;
border: 1px solid red;
}
.bb {
position: absolute;
bottom: 0;
border: 1px solid green;
}
.c1 {
border: 1px solid blue;
}
.c2 {
border: 1px solid orange;
}
<div class="contain">
<div class="p">
<div class="c1">
<p>Random Height and text Random Height and text Random Height and text Random Height and text Random Height and text Random Height and text Random Height and text Random Height and text Random Height and text</p>
</div>
<div class="c2">
<p>Go to bottom, but on top of bottom bumper - text can grow sdfkjlkfdj;lksjdf;</p>
</div>
<div class="bb">
<p>---------------Button--------------</p>
</div>
</div>
<div class="p">
<div class="c1">
<p>Random Height and text Random Height and text Random Height and text Random Height and text Random Height and text Random Height and text Random Height and text Random Height and text Random Height and textRandom Height and text Random Height and
text Random Height and text Random Height and text Random Height and text Random Height and text Random Height and text Random Height and text Random Height and text</p>
</div>
<div class="c2">
<p>Go to bottom, but on top of bottom bumper - text can grow sdfkjlkfdj;lksjdf;</p>
</div>
<div class="bb">
<p>-------Button-------</p>
</div>
</div>
<div class="p">
<div class="c1">
<p>Random Height and text Random Height and text Random Height and text Random Height and text Random Height and text Random Height and text Random Height and text Random Height and text Random Height and textRandom Height and text Random Height and
text Random Height and text Random Height and text Random Height and text Random Height and</p>
</div>
<div class="c2">
<p>Go to bottom, but on top of bottom bumper - text can grow sdfkjlkfdj;lksjdf;</p>
</div>
<div class="bb">
<p>-------Button-------</p>
</div>
</div>
<div class="p">
<div class="c1">
<p>Random Height and text Random Height</p>
</div>
<div class="c2">
<p>Go to bottom, but on top of bottom bumper - text can grow sdfkjlkfdj;lksjdf;</p>
</div>
<div class="bb">
<p>---------------Button--------------</p>
</div>
</div>
<div class="p">
<div class="c1">
<p>Random Height and text Random Height</p>
</div>
<div class="c2">
<p>Go to bottom, but on top of bottom bumper - text can grow sdfkjlkfdj;lksjdf;</p>
</div>
<div class="bb">
<p>-------Button-------</p>
</div>
</div>
<div class="p">
<div class="c1">
<p>Random Height and text Random Height</p>
</div>
<div class="c2">
<p>Go to bottom, but on top of bottom bumper - text can grow sdfkjlkfdj;lksjdf;</p>
</div>
<div class="bb">
<p>-------Button-------</p>
</div>
</div>
</div>
are really images for me - they will always be square. The width of the square-box containers are driven by bootstrap - .square-box{ width: 100%; text-align: center; padding-bottom: 100%; position:relative; } .box-item { position:absolute; }
– RooksStrife Mar 29 '16 at 20:16