If you're in need of a flex box CSS solution, look no further! Check out my example on jsfiddle:
jsfiddle
.container {
display: box;
display: -webkit-box;
display: -moz-box;
display: -ms-box;
box-pack: start;
-webkit-box-pack: start;
-moz-box-pack: start;
-ms-box-pack: start;
box-align: stretch;
-webkit-box-align: stretch;
-moz-box-align: stretch;
-ms-box-align: stretch;
box-orient: horizontal;
-webkit-box-orient: horizontal;
-moz-box-orient: horizontal;
-ms-box-orient: horizontal;
}
.container .column {
max-width:200px;
display: box;
display: -webkit-box;
display: -moz-box;
display: -ms-box;
box-pack: start;
-webkit-box-pack: start;
-moz-box-pack: start;
-ms-box-pack: start;
box-flex: 1;
-webkit-box-flex: 1;
-moz-box-flex: 1;
-ms-box-flex: 1;
box-orient: vertical;
-webkit-box-orient: vertical;
-moz-box-orient: vertical;
-ms-box-orient: vertical;
box-align: stretch;
-webkit-box-align: stretch;
-moz-box-align: stretch;
-ms-box-align: stretch;
}
.column .dynamic-content {
display: box;
display: -webkit-box;
display: -moz-box;
display: -ms-box;
box-orient: vertical;
-webkit-box-orient: vertical;
-moz-box-orient: vertical;
-ms-box-orient: vertical;
box-pack: start;
-webkit-box-pack: start;
-moz-box-pack: start;
-ms-box-pack: start;
box-align: start;
-webkit-box-align: start;
-moz-box-align: start;
-ms-box-align: start;
box-flex: 1;
-webkit-box-flex: 1;
-moz-box-flex: 1;
-ms-box-flex: 1;
}
.container .dynamic-content {
box-shadow: 1px 1px 2px 1px darkgrey;
margin: 2px;
background: lightcyan;
}
This is a pure CSS solution, no JavaScript required.
Simply change the "dynamic-content" divs to adjust the column layouts accordingly.
Below is the HTML code from my jsfiddle:
<div class="container">
<div class="column">
<div class="dynamic-content">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
<p>Sample Sample</p>
<p>Sample Sample</p>
</div>
<div class="dynamic-content">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum</p>
</div>
</div>
<div class="column">
<div class="dynamic-content">
<span>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</span>
</div>
<div class="dynamic-content">
<span>Lorem ipsum dolor sit amet, consectetur adipisicing elit, ...</span>
<p>Sample Sample</p>
</div>
</div>
<div class="column">
<div class="dynamic-content">
<span>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim...
</div>
<div class="dynamic-content">
<p><span>Lorem ipsum dolor sit amet, consectetur...
</div>
</div>
</div>