Seeking a method to control the aspect ratio of an image tag. Unfortunately, the aspect-ratio property is not widely supported at the time of writing this post.
Typically, I would place the element in a container and apply padding-top to achieve the desired effect. However, my current content is inline with other elements and I am unable to modify the HTML structure.
The container's width adapts to make the image responsive, so directly setting height and width is not a viable option.
For instance, ensuring an image maintains a 16:9 ratio within a container, regardless of its visual scale. I aim to have the image adjust accordingly using
object-fit: cover
Is there a specific technique that can be applied directly to the img tag itself?