I have tried adapting this post and its alistapart links. But I can't get my three blocks in a container to act responsively and maintain their aspect ratio
<div class="hpGridTopRow">
<span class="hpBox lightBlue one">
<p class="hbBoxesp">New to Restore</p>
</span>
<span class="hpBox green two">
<p class="hbBoxesp">Events</p>
</span>
<span class="hpBox midBlue three">
<p class="hbBoxesp">Talks</p>
</span>
</div>
I need them to arrange themselves to the borders of the hpGridTopRow div so I am using flex - and its working well.
However, the layout has to be responsive - the aspect ratio of the containers needs to stay fixed as their widths change.
Here's the css
.hpGridTopRow,
.hpGridBottomRow {
display: -webkit-flex;
display: flex;
-webkit-justify-content: space-between;
justify-content: space-between;
position: relative;
padding-bottom: 20%;
height: 0;
overflow:hidden;
background:yellow;
}
.hpBox {
width:24.18803418803419%;
text-align:center;
height:264px;
height:100%;
}
.hpBox.one {
width:49.4017094017094%;
}
.lightBlue {
background:#15b2d2;
}
.green {
background:#8cc63f;
}
.midBlue {
background:#6a8aa8;
}
.hbBoxesp {
color:#fff;
margin-top:40px;
}
I have created a jsfiddle - as you can the container background shows, but not the actual boxes and said container is behaving responsively.
How can I get the spans to behave properly?