How do I make website images responsive?

How do I make website images responsive?

Responsive images should adapt to the available space without stretching, overflowing or breaking the page layout. They should also be appropriately sized so visitors do not download unnecessarily large files.

1. Make the image fit its container

If you are adding images with HTML and CSS, the image should be allowed to scale within its containing element.

A common approach is:

				
					img {
max-width: 100%;
height: auto;
}
				
			

This allows an image to shrink when the available space is smaller while preserving its proportions.

2. Avoid fixed image dimensions that cause overflow

A fixed width can cause problems on smaller screens.

For example, an image set to a width larger than the mobile screen may extend beyond the page and create horizontal scrolling.

Use flexible sizing where appropriate and check how the image behaves at different screen widths.

3. Use appropriately sized image files

Making an image responsive does not automatically make the file efficient.

Do not upload a very large image when a much smaller version is sufficient for the space in which it will be displayed.

Resize and compress images appropriately before uploading them, while maintaining sufficient visual quality.

4. Use responsive image formats where appropriate

Modern websites can provide different image files for different screen sizes.

HTML features such as srcset and sizes allow the browser to select an appropriate image resource based on the device and display size.

This can reduce unnecessary downloads.

5. Check how images are cropped

Some layouts intentionally crop images using techniques such as object-fit: cover.

Check the mobile version to make sure important parts of the image are not accidentally cut off.

For images where the entire image needs to remain visible, a different sizing approach may be more appropriate.

6. Add appropriate alternative text

Responsive design does not replace accessibility.

Meaningful images should have appropriate alternative text, while purely decorative images can generally use an empty alt attribute.

Last Updated 2nd February 2026.

Was this article helpful?

We publish our Knowledge Base to help individuals and businesses resolve common issues across websites, advertising platforms, Salesforce and other digital systems.

We regularly review and update our guides, but the platforms, software and services covered can change without notice. As a result, screenshots, settings, features or recommended processes may differ from those available when an article was last reviewed.

The information provided is general guidance and should not be treated as advice specific to your systems or circumstances. UTDS Optimal Choice cannot accept responsibility for errors, data loss, service disruption or other issues resulting from changes made by following these guides.

If you are unsure about any of the steps, particularly where a change could affect live systems, data, tracking or business processes, we recommend speaking to us before making the change. Our team can review your specific setup and provide advice based on the current platform and configuration.

Time for some professional support?

Our team are ready to help. As one of the few digital agencies that is both a registered Salesforce Consulting Partner and Google Partner Agency, UTDS Optimal Choice is expertly positioned to support you across your entire digital landscape.

Related Pages