Avoid distorted images Usability Guideline

Description

The aspect ratio of the img width and height attributes doesn’t match the image file. This means the image will be distorted, or will resize as it loads.

Help

Change width and height so they have the same aspect ratio as the image file (for example, a 1200 x 800 image can use width="600" height="400"), or crop the image file to the shape you need. Scaling an image while keeping its aspect ratio, such as a 2x image for high-DPI screens, doesn’t distort it. If CSS sets height: auto the image isn’t distorted, but the layout shifts when it loads because the attributes reserve the wrong amount of space.

Applicable standards

Change history

  • 2026.62 Oct 2026 Now detects small distortions, and distorted images with transparent backgrounds.
  • 6.57 Jun 2025 Don’t fire for scaled images that maintain aspect ratio.
  • 6.53 Jul 2024 Don’t fire for hidden images.
  • 5.24 Dec 2016 Don’t fire for zero size images.
  • 5.9 Jun 2015 Don’t fire for responsive images.
  • 2.0 Dec 2007 Added.

This page describes a web site issue detected in HTML documents by SortSite Desktop and OnDemand Suite.

Rule ID: UseImgWidthHeightScaled