<div class="flex-container">
  <div class="flex-item flex-item-1">1</div>
  <div class="flex-item flex-item-2">2</div>
  <div class="flex-item flex-item-3">3</div>
  <div class="flex-item flex-item-4">4</div>
</div>
.flex-container {
  padding: 0;
  margin: 0;
  outline: 1px solid red;
  margin: 2em auto;
  
  /* flex box property start */
  display: -webkit-box;
  display: -moz-box;
  display: -ms-flexbox;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-flow: row wrap;
  justify-content: space-around;
}

/* optional child div styling */
.flex-item {
  background: red;
  color: white;
  font-weight: bold;
  font-size: 3em;
  text-align: center;
  margin: 1em;
  flex: 1 1 auto;
  outline: 5px solid black;
  }
  

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.