Setting variable hight on elements [closed]

19 hours ago 3
ARTICLE AD BOX

i have a loop of wordpress posts - each post is a horizontal flex container with an <img> on the left and a <div> on the right with content of variable height (posts flow one below another). i want to have a fixed width on the img (326px) and a height with auto or align-self:stretch so that the height will always be the same as that of the content div. this works fine, just.. not always. basically, based on the content that the content div may have, there are 3 heights for it, lets say small, medium and big. what happens is for sizes small and big the img gets the right height based on the content div, but not for size medium, strangely.. and while testing in inspect i saw that if i reduce the width of the img to something like 300px, then the height of the img will be ok everywhere. its all very strange to me and im looking to understand the root of the problem, what is it?

and to be honest, and to maybe help you help me, the solution i found is to use divs instead of imgs and set the background of the divs to be the image, but i really want to know whats the core logic for why it doesnt work with <img>.

Read Entire Article