How to fix: An img element must have an alt attribute, except under certain conditions. for details, consult guidance on providing text alternatives for images.

Most Likely Cause and Fix

Your markup contains an <img> element that lacks the required alt attribute.

Use:

<img src="http://example.com/image.png" alt="Relevant textual alternative to the image" … />

instead of:

<img src="http://example.com/image.png" … />

What This Means

The <img> element must contain an alt attribute.

This error is telling you that your markup contains a <img> element that is lacking the required alt attribute.

How To Fix It

The line and column number of specific error message you encountered will point you to the relevant <img> element.

Add the missing, required, alt attribute.

Use:

<img src="http://example.com/image.png" alt="Relevant textual alternative to the image" … />

instead of:

<img src="http://example.com/image.png" … />

Discuss, Comment and Improve

Did this help you? Can this page be improved? Let us know!

comments powered by Disqus