height auto width 100% will ignore width and height code example
Example: height auto width 100% will ignore width and height
<style>
img {
width: 100%;
height: auto;
aspect-ratio: attr(width) / attr(height);
}
</style>
<img src="hero_image.jpg" alt="" width="500" height="500">