For those willing to utilize jQuery, implementing this is quite straightforward. Just assign the same class to both divs and insert the code snippet below at the end of your webpage before the </body>
tag within <script></script>
.
$(function() {
$('.myClass').matchHeight();
});
Nevertheless, there are two crucial steps that cannot be ignored.
- Include jQuery
- Include jquery.matchHeight.js (available for download at: https://github.com/liabru/jquery-match-height)
This solution ensures responsiveness, enabling the image height to adapt accordingly on a responsive layout without enforcing fixed dimensions.