HTML + CSS TRICKS, FLOAT LEFT DIV WITH EQUAL HEIGHT, MAGIC OF USING FLEX

HTML + CSS TRICKS, FLOAT LEFT DIV WITH EQUAL HEIGHT, MAGIC OF USING FLEX

by Pritom K Mondal

HTML

<section class="container">
  <div class="left-half">
    <article>
      <h1>Left Half 1</h1>
    </article>
  </div>
  <div class="left-half">
    <article>
      <h1>Left Half 2</h1>
    </article>
  </div>
  <div class="left-half">
    <article>
      <h1>Left Half 3</h1>
      <p>Weekends don't</p>
    </article>
  </div>
  <div class="left-half">
    <article>
      <h1>Left Half 4</h1>
      <p>Weekends don't</p>
      <p>Weekends don't</p>
    </article>
  </div>
  <div class="left-half">
    <article>
      <h1>Left Half 5</h1>
      <p>Weekends don't</p>
      <p>Weekends don't</p>
    </article>
  </div>
  <div class="left-half">
    <article>
      <h1>Left Half 6</h1>
      <p>Weekends don't</p>
    </article>
  </div>
</section>

CSS

/* Pen-specific styles */
html, body, section {
  height: 100%;
}

body {
  color: #fff;
  font-family: sans-serif;
  font-size: 1.25rem;
  line-height: 150%;
  text-align: center;
  text-shadow: 0 2px 2px #b6701e;
}

h1 {
  font-size: 1.75rem;
  margin: 0 0 0.75rem 0;
}

/* Pattern styles */
.container {
  display: flex;
  flex-flow: row wrap;
  justify-content: flex-start;
}

.left-half {
  background-color: #ff9e2c;
  padding: 0;
  width: calc(50% - 6px);
  border: 2px solid red;display: flex;
    justify-content: flex-start;
    align-items: flex-start;
}