About This HTML Issue
The height attribute on an img element contains the string auto" instead of a valid non-negative integer, likely due to a typo with an extra quote.
The height attribute on img elements only accepts non-negative integers representing the image’s height in CSS pixels. Values like auto, percentages, or any non-numeric strings are not valid. The extra trailing quote (") in auto" suggests a copy-paste error or a quoting mistake in your markup.
If you want the image height to adjust automatically, simply omit the height attribute altogether, or set height: auto in CSS instead. It’s still recommended to include both width and height attributes with actual pixel values to help the browser reserve the correct space and prevent layout shifts (CLS).
Invalid Example
<img src="photo.jpg" alt="A photo" width="600" height="auto">
Fixed Example
Using CSS for automatic height while keeping the HTML attribute for layout stability:
<img src="photo.jpg" alt="A photo" width="600" height="400" style="height: auto;">
Or simply omit the height attribute if you don’t know the intrinsic dimensions:
<img src="photo.jpg" alt="A photo" width="600">
Find issues like this automatically
Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.