0

I'm making a page that has a header, a table and a footer. The header and footer have a fixed height, and the table is supposed to fill the rest of the page height, with some rows having a fixed height and some expanding to fill the remaining height.

After a bit of research I made it work using flex layout, except that it doesn't work in Chrome. FF/IE/Edge stretches the table as I want, but not Chrome for some reason. What am I doing wrong?

CodePen example: http://codepen.io/anon/pen/memxjP

HTML:

<div class='flexbox'>
  <div class='flex'>
    <h1>Header</h1>
    <div class='flex-child'>
      <table>
        <tr><td>xx</td></tr>
        <tr class='fill'><td>xx</td></tr>
        <tr><td>xx</td></tr>
        <tr class='fill'><td>xx</td></tr>
        <tr><td>xx</td></tr>
      </table>
    </div>
  </div>
  <div class='footer'>
    footer
  </div>
</div>

CSS:

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
}

.flexbox {  
  background: black;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.flex {
  background: blue;
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.flex-child {
  flex: 1;
  background: red;  
}

table {
  height: 100%;
  width:100%;
  border: solid thin white;
}

h1 {
  height: 2em;
}

tr {
  height: 1em;
}

tr.fill{
  height: auto;
  background-color: white;
}

td {
  border: solid thin black;

}

.footer{
  background: green;
  width: 100%;
  height: 5em;
}
Rune
  • 9
  • 1
  • For reference, it's not just `table` elements that do not fill: http://codepen.io/anon/pen/OygdPE – Alexander O'Mara Oct 09 '15 at 23:19
  • Ah, yes. For some reason I was stuck on the idea that it had something to do with the table. That simplifies it a bit, but the problem persists – Rune Oct 09 '15 at 23:23
  • Yes, it is a duplicate of that one. I guess I didn't find it when I googled for this since I was so focused on table related problems. The position relative/absolute trick from that question did the trick. Thanks for the help! – Rune Oct 09 '15 at 23:28

0 Answers0