<div class="container">
  <p class="viewport">Viewport width: <span class="c-viewport__width" id="vpWidth"></span>px
  </p>
  <div class="flex-wrapper">
    <div class="element main">
      <h2>Main</h2>
      <p>Gingerbread soufflé brownie pie marzipan. Gummies pie pudding icing chocolate cake apple pie chocolate bar. Sweet marzipan powder lollipop gummi bears chupa chups jelly beans marshmallow. Tootsie roll chocolate cake marshmallow. Sesame snaps pastry cotton candy tart applicake. Candy lemon drops cheesecake jelly cake jelly beans oat cake biscuit.</p>
      <p>Apple pie cupcake wafer pie ice cream sugar plum caramels tart brownie. Chocolate cake cotton candy tiramisu lollipop. Carrot cake biscuit wafer jelly soufflé sesame snaps gummi bears.</p> 
    </div>

    <div class="element sidebar">
      <h2>Sidebar</h2>
      <p>Pudding bear claw chocolate cake gingerbread candy bear claw jelly wafer applicake. Candy jelly beans lollipop tootsie roll applicake lemon drops. Croissant croissant cupcake chupa chups sweet applicake cheesecake biscuit cotton candy.</p>
    </div>
  </div>
</div>
body {
	background: #f0f0f0;
  font-size: 1.1em;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.container {
  margin: 2em auto;
  max-width: 45em;
  border: 1px solid #aaa;
  padding: 1em;
}

.element {
  padding: 1em;
  background-color: white;
}

.viewport {
  position: absolute;
  font-size: 75%;
  padding: 5px;
  color: grey;
  background: white;
  top: 0;
  left: calc(50% - 70px);
  border-radius: 11px;
  box-shadow: 1px 1px 5px 0px rgba(0,0,0,0.25);
}

.flex-wrapper {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap
}

@media (min-width: 35em) {
  .flex-wrapper {
    -ms-flex-wrap: nowrap;
    flex-wrap: nowrap;
  }  

  .main {
    -webkit-box-flex: 1;
    -ms-flex: 1 1 67%;
    flex: 1 1 67%;
    background-color: green;
  }
  .sidebar {
    -webkit-box-flex: 1;
    -ms-flex: 1 1 33%;
    flex: 1 1 33%;
  }
}

@media (max-width: 35em) {
  .main {
    -webkit-box-flex: 1;
    -ms-flex: 1 1 100%;
    flex: 1 1 100%;
    background-color: red;
  }

  .sidebar {
    -webkit-box-flex: 1;
    -ms-flex: 1 1 100%;
    flex: 1 1 100%;
  }
}