I am attempting to set the height of an image to the height of the text which is adjacent.
I've tried using the jQuery code which I found in an answer to the question How to set height of element to match height of another element?, however it makes the image too large (it's height is higher than the text).
$("#img").css("height", $(".text").height());
img {
float: left;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="here">
<img src="https://images-na.ssl-images-amazon.com/images/M/MV5BMzg2Mjg1OTk0NF5BMl5BanBnXkFtZTcwMjQ4MTA3Mw@@._V1_SX300.jpg" id="img">
<div class="text">
<h2>Example</h2>
<p>Example Example Example Example Example Example Example Example Example Example Example Example Example Example Example Example Example Example Example Example Example Example</p>
<p>Example Example</p>
<p>Length: 111 min</p>
<p>Example Example Example</p>
<p>Example Example Example Example Example Example Example Example Example Example Example</p>
</div>
</div>
It would not work to manually set the height, as the image and text are dynamic, meaning they can change.
JsFiddle: https://jsfiddle.net/y9f0xhm0/