Chrome flex-basis column workaround

by medmunds

HTML

<div class="container">
  <div class="layout row">
    <div class="chromefix small">row: 30%</div>
    <div class="chromefix large">
      <div class="layout column">
        <div class="small">row: 70%; col: 30%</div>
        <div class="large">row: 70%; col: 70%</div>
      </div>
    </div>
  </div>
</div>
<p>Chrome</p>

CSS

.container {
  width: 300px;
  height: 300px;
  display: flex;
}

.layout {
  flex-grow: 1;
  flex-shrink: 1;
  flex-basis: 100%; /* within its parent */
  display: flex;
  background: #ffc;
}

.row {
  flex-direction: row;
}

.column {
  flex-direction: column;
}

.small {
  flex-grow: 1;
  flex-shrink: 1;
  flex-basis: 30%;
  background: #cff;
}

.large {
  flex-grow: 1;
  flex-shrink: 1;
  flex-basis: 70%;
  background: #fcf;
}

.rest {
  flex-grow: 1;
  flex-shrink: 1;
  flex-basis: auto;
  background: #fcc;
}

.chromefix {
  display: block;
  position: relative;
  border-color: red;
}

.chromefix > *:only-child {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
}

div {
  /* border/padding just makes divs easier to see --
     example has same problem without this */
  box-sizing: border-box;
  border: 1px solid #999;
  padding: 10px;
}

body {
  background: #fff;
  font: 12px sans-serif;
  padding: 20px;
}

p {
  font-size: 14px;
  margin-top: 10px;
}