When using Flexbox to style elements, the width of the parent should be determined by the text inside child1. The image inside child2 should grow proportionately as the parent grows. However, it is important to ensure that the parent div does not exceed its max-width limit. If an image is placed inside the parent div, there may be issues with the parent enlarging.
#parent {
display: flex;
flex-direction: column;
min-width: 10px;
max-width: 240px;
}
<div id="parent">
<div id="child1">text here should decide parent width</div>
<div id="child2"><img src="https://picsum.photos/400/100" alt="Image" /></div>
</div>