Within the parent div, I have two child div elements that are meant to be positioned side by side. The first element contains an image which loads dynamically, meaning its height is unknown in advance. I want the parent div's total height to match the height of the image - achieved by setting the height to auto. However, the challenge arises with the text on the right. I need it to fill the available height next to the image without extending beyond it and creating a gap below the image. To ensure this, I would like the text to be cut off with overflow set to scroll if it becomes too long.
The main issue I face is how to make the text element on the right respect the height of the image on the left. Since the image cannot be the parent element to the text due to being an image itself, passing its height to the text seems tricky. One potential solution could involve placing the image on the right as well, hiding it, and positioning the text above it. But this method might not be the most elegant approach.
If you have any suggestions or tips on how to address this issue, they would be greatly appreciated.
Update: As I am using React, I would prefer to avoid relying on jQuery for any possible solutions.