flex box layout

by Tyler Brown

HTML

<h1>frrrp</h1>
<div id="app" class="flex-col">
  <div id="header">
    <h1>App Header</h1>
  </div>
  <div id="body" class="flex-col">
    <div id="page-widther" class="flex-col">
      <h1 id="page-title">Page Header</h1>
      <div id="page-content" class="flex-row">
        <div id="pc-list">
          c<br />c<br />c<br />c<br />c<br />c<br />c<br />c<br />c<br />c<br />c<br />c<br />c<br />c<br />c<br />c<br />
        </div>
        <div id="pc-item">
          <h1>Content Item</h1><h1>Content Item</h1><h1>Content Item</h1><h1>Content Item</h1>
        </div>
      </div>
      <h1 id="page-footer">Page Footer</h1>
    </div>
  </div>
</div>

SCSS

* {
  flex: 0 1 auto;
}
h1 {
  font-size: 16px;
  margin: 0;
  padding: 10px;
}

.flex-row {
  -ms-flex: 1;
  flex: 1;
  display: -ms-flexbox;
  display: flex;
  min-height: 0;
  -ms-flex-direction: row;
  flex-direction: row;
  align-items: stretch;
}
.flex-col {
  -ms-flex: 1;
  flex: 1;
  display: -ms-flexbox;
  display: flex;
  -ms-flex-direction: column;
  flex-direction: column;
  align-items: stretch;
  min-height: 0;
}

#app {
  border: 1px solid black;
  width: 400px; height: 250px;
  
  #header {
    background-color: lightgray;
  }

  #body {
    border: 1px solid red;
    
    #page-widther {
      border: 1px solid yellow;
      width: 300px;
      margin: 0 auto;
    }

    #page-title {
      background-color: lightblue;
    }
    
    #page-footer {
      background-color: lightgreen;
    }
    
    #page-content {
      
      #pc-list {
        overflow: auto;
        width: 20%;
        background-color: white;
        padding: 10px;
      }
      
      #pc-item {
        background-color: #CCC;
        flex: 1;
        overflow: auto;
      }
    }
  }
}