title: Flexbox within a flexbox - is it possible?
body: <p>I'm trying to achieve the following layout:</p>
  
  <pre><code>+---------+---------------------+
  |legend   |                     |
  +---------+                     |
  |csv_input|        map          |
  |         |                     |
  |         |                     |
  |         |                     |
  +---------+---------------------+
  
  +---------+-------+
  |legend   |       |
  +---------+  map  |
  |csv_input|       |
  |         |       |
  +---------+-------+
  </code></pre>
  
  <p><a href="https://jsfiddle.net/zwjm16p3/1/" rel="nofollow">https://jsfiddle.net/zwjm16p3/1/</a></p>
  
  <p>With this HTML and CSS:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>*,
  *:before,
  *:after {
    box-sizing: border-box;
  }
  html,
  body,
  div#wrapper,
  div#map {
    height: 100%;
  }
  body {
    padding: 0;
    margin: 0;
    display: flex;
    min-height: 100vh;
    flex-direction: column;
  }
  #wrapper {
    display: flex;
    flex: 1;
    background: #fef;
  }
  #map {
    flex: 1;
    background: #ffe;
  }
  #sidebar {
    order: -1;
    flex: 0 0 20em;
    height: 100%;
    background: #eff;
  }
  #sidebar_wrapper {
    height: 100%;
    width: 100%;
    background: #eef;
    display: flex;
    min-height: 100vh;
    flex-direction: row;
  }
  #legend {
    width: 100%;
    background: #efe;
    flex: 2em 0 0 0;
  }
  #csv_input {
    width: 100%;
    background: #eef;
    flex: 1;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="wrapper"&gt;
    &lt;div id="map"&gt;&lt;/div&gt;
    &lt;div id="sidebar"&gt;
      &lt;div id="sidebar_wrapper"&gt;
        &lt;div id="legend"&gt;
          Paste CSV data below.
        &lt;/div&gt;
        &lt;textarea id="csv_input"&gt;&lt;/textarea&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>What I see is:</p>
  
  <pre><code>+----+----+---------------------+
  |lege|csv_|                     |
  |    |    |                     |
  |    |    |        map          |
  |    |    |                     |
  |    |    |                     |
  |    |    |                     |
  +----+----+---------------------+
  </code></pre>
  
  <p>I have two questions:</p>
  
  <ol>
  <li>Why is <code>flex-direction: row;</code> being ignored?</li>
  <li>Do I need the <code>#sidebar_wrapper</code> div, or can a div both be the child in one flexbox and the container of another?</li>
  </ol>