I have 3 divs nested within a parent div. My goal is to dynamically set the height of all the child divs to match the height of the div with the maximum height, even when the screen resizes due to responsiveness.
Below is my HTML structure:
<div class="mid-box-mid row">
<!-- Featured Box 1 -->
<div class="mid-box col-xs-12 col-sm-4">
<div class="skt-iconbox iconbox-top">
<h4>Population<br><span>Health management</span></h4>
</div>
<div class="iconbox-content">
Our Population Health Management helps physicians and their offices to strategically manage clinical and cost opportunities by improving overall healthcare quality of individuals care effectively and efficiently.
</div>
<div class="clearfix"></div>
</div>
<!-- Featured Box 2 -->
<div class="mid-box col-xs-12 col-sm-4">
<div class="skt-iconbox iconbox-top">
<h4>Population<br><span>Health management</span></h4>
</div>
<div class="iconbox-content">
Our Population Health Management helps physicians and their offices to strategically manage clinical and cost opportunities by improving overall healthcare quality of individuals care effectively and efficiently.
</div>
<div class="clearfix"></div>
</div>
<!-- Featured Box 3 -->
<div class="mid-box col-xs-12 col-sm-4">
<div class="skt-iconbox iconbox-top">
<h4>Population<br><span>Health management</span></h4>
</div>
<div class="iconbox-content">
Our Population Health Management helps physicians and their offices to strategically manage clinical and cost opportunities by improving overall healthcare quality of individuals care effectively and efficiently.
Our Population Health Management helps physicians and their offices to strategically manage clinical and cost opportunities by improving overall healthcare quality of individuals care effectively and efficiently.
</div>
<div class="clearfix"></div>
</div>
</div>
CSS styles applied:
.mid-box-mid{
background-color:green;
}
.mid-box{
background-color:red;
padding:80px 40px;
}
Javascript code used for setting dynamic heights:
$('.mid-box-mid >div').height($('.mid-box-mid >div:nth-child(3)').height());
$( window ).resize(function() {
$('.mid-box-mid >div').height($('.mid-box-mid >div:nth-child(3)').height());
});
Check out the live demo on FIDDLE