title: flexbox one element fixed height, other filling
body: <p>I want to make some kind of image viewer with some descriptive text below. Problem is, that the lower box with the description has a fixed height and the image should fill the remaining height of whatever container it is in.</p>
  
  <p>I wanted to use flexbox for that, as I think it seems to be the most elegant and simple solution (without using JS).
  This this code and codepen for my current work, which seems to work mostly: </p>
  
  <pre><code>html,  body,  #container {
      height: 100%
  }
  #container {
      display: flex;
      flex-direction: column;
  }
  #container &gt; #image {
  /* flex-grow: 1; */ /* not needed here? */
      max-width: 75%;
      background-color: #fcc;
      margin: 0 auto;
  }
  img {
       max-height: 100%;
      /* HERE IS WHERE MY PROBLEM STARTS!; */
       max-width: 100%;
  }
  #container &gt; #text {
      flex-grow: 0;
      flex-shrink: 0;
      background-color: rgba(128, 128, 128, 0.7);
      padding: 5px;
      max-width: 75%;
      margin: 15px auto 0;
  /*  TOP MARGIN DOESN'T WORK */
  }
  </code></pre>
  
  <p><a href="http://codepen.io/Kageetai/pen/AaCJy" rel="noreferrer">http://codepen.io/Kageetai/pen/AaCJy</a></p>
  
  <p>I got most of it to work but the image is not resizing itself correclty. As you can see through the transparent background of the text box, it stretches itself over the border of the containing div and even behind the text box.
  So how can I retain the image with the correct aspect ratio inside its container?</p>
  
  <p>And furthermore the centering with <code>margin: 0 auto;</code> seems to make problems when resizing the window. The image is not centered anymore and the page needs a refresh to make it work again.</p>
  
  <p>So does anyone know how to make the image behave correctly? :)</p>