If you're looking for a solution using Flexbox, I recommend utilizing the snippet below. The key aspect here is setting the viewport height with min-height: 100vh
; The vh
property (which stands for viewport height) is widely supported by browsers.
For a live demonstration, please refer to the code snippet provided.
$(function() {
$(document).on('click', '.deck', function(evt) {
$newEl = $('#copy-me').clone().text(HolderIpsum.words(~~(Math.random() * 20), true));
$('.deck').append($newEl);
});
});
body {
background-color: gray;
}
.deck {
width: 100vw;
min-height: 100vh;
display: flex;
flex-wrap: wrap;
background-color: white;
padding: 1em;
align-items: stretch;
}
.deck::after {
content: 'CLICK ANYWHERE IN WHITE BOX TO ADD MORE CONTENT';
order: 999;
background-color: transparent !important;
color: gray !important;
border-color: gray !important;
}
.deck::after, .deck__card {
flex: 33% 0 1;
padding: 0.5em;
margin: 1em;
border: 2px solid orange;
background-color: blue;
color: orange;
font-size: 2em;
font-family: sans-serif;
height: auto;
min-height: 33vh;
order: 1;
}
<script src="https://cdn.jsdelivr.net/holder-ipsum/0.1/holder-ipsum.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="deck">
<div id="copy-me" class="deck__card" data-holder-ipsum-mode="words" data-holder-ipsum-words-count="3"></div>
</div>