I have a section with two containers, a text container and an img container. The text container's height changes when I open the details list (which I want), but I can't get the image to resize as well, while keeping a 50/50 width. Both containers are 50vw.
<section>
<div class="textContainer">
<details>Long list of content</details>
</div>
<div class="imgContainer">
<img src="" alt="">
</div>
</section>
I want the height of the section to be fit-content based on the content of the textContainer, and the textContainer to be fit-content, based on its content (obviously). HOWEVER I want the image's height to be the same as the textContainer, when the details is closed and when it is open.
Any suggestions?
Oh and I've got 9 of these sections, each with different length of text content.
I've tried fiddling with max-height/max-width on the image. Tried a bunch of object-fits and even tried with some JS.
img.setAttribute = ("height", textBox.offsetHeight)
But I always get the result on this image: