I'm working with an image element that has the style attribute set to style='width:40%;height:40%'
. My goal is to add a div around this image that will automatically adjust its size to wrap around the image. However, when I try inserting the div, it does not properly wrap the image and instead expands to fit the entire div.
Is there a way to make this div wrap around the img so that it can be used as a frame? The challenge here is that I cannot set preset height and width values for the div because the percentages of the img's dimensions are dynamic. So, the div needs to adapt to the size of the image itself.