Sorry, it's late here and I can't figure this out...
I have a responsive div, split into two vertically. These are set to display inline, side-by-side horizontally:
[1][2]
unless the viewport shrinks below 400px wide, then they stack vertically - like this:
[1]
[2]
This works fine until I add a second set:
[1][2]
[3][4]
then, when the viewport shrinks below 400px wide, [2] gets hidden behind [3]:
[1]
[3]
[4]
Here's a demo that's clearer: http://jsfiddle.net/c14n6ym4/. I'm missing something, can anyone help? Thanks for your time.
CSS:
.wrapper {
width: 100%;
display: inline-block;
position: relative;
}
.wrapper:after {
padding-top: 40%;
display: block;
content: '';
}
.main {
position: absolute;
top: 0;
bottom: 0;
right: 0;
left: 0;
font-size: 0;
}
#left,
#right {
font-family: serif;
font-size: 20vw;
display: inline-flex;
width: 50%;
height: 100%;
float: left;
}
@media (max-width: 400px) {
#left,
#right {
font-size: 40vw;
width: 100%;
}
.wrapper:after {
padding-top: 80%;
}
}