I'm attempting to code a Holy Grail-style single-page app UI using CSS Flexbox which meets the following criteria:
- Overall container will take exactly 100% of the viewport height and only its internal panels will scroll
- Static header
- Fluid main content area, consisting of 2 content "panels" that will scroll using
overflow-y
when necessary - Static footer
The HTML for this setup looks as such:
<div class="container">
<header>Header</header>
<main role="main">
<article class="box1">
Article contents (Box 1)
</article>
<nav class="box2">
Navbar contents (Box 2)
</nav>
</main>
<footer>Footer</footer>
</div>
And the CSS (with prefixes omitted for simplicity):
html, body {
height: 100%;
}
.container {
display: flex;
flex-direction: column;
height: 100%;
}
header {
flex: none;
height: 100px;
}
main {
flex: 1;
display: flex;
flex-direction: row;
}
.box1 {
order: 2;
flex: 3;
overflow-y: auto;
background-color: #BCD39B;
}
.box2 {
order: 1;
flex: 1;
overflow-y: auto;
background-color: #CE9B64;
}
footer {
flex: none;
height: 100px;
}
And here's a Codepen example: http://codepen.io/anon/pen/VeXgMK
If you fire it up, it works great in the newest Chrome (47) and Safari (9). However, the two main panels don't work at all in Firefox (44) - they neither respect their flex
values nor scroll vertically as expected.
Firefox seems to dislike the use of flex-direction
for some reason, but I'm not sure how to achieve my desired UI without it. I'd love to know what quirks I should be dealing with proactively to accomplish this layout effectively cross-browser.