Let's say I have an image tag inside of a div, like so:
<div class="parent">
<img class="child" src="url" alt="" />
</div>
I want the parent div to have a padding all all four sides that is equal to half the length of the image's height. So, if the image has a dimension of 200px by 50px, I want the parent's padding to be 25px on all four sides.
I want to do this so that it's responsive to changes in the image's size -- i.e. not hard coding the values.
Any way to do this? Thanks.