How to fix: Required attribute "src" not specified

Most Likely Cause and Fix

Your markup contains an <img /> element that lacks the required src attribute:

<img … />

Add a src attribute to each <img /> element where missing:

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

What This Error Means

There is a defined set of attributes for each HTML element. Some are required for your markup to be considered valid.

You have omitted the required src attribute on an element that requires it.

How To Fix It

The specific error message you encountered will refer to a line and column number. This will guide you to the exact point in your markup to which the error relates.

For images

You've most likely forgotten to add a src attribute to an <img /> element:

<img … />

Add an alt attribute to each <img /> element where missing:

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

In general

Find the relevant element and add the missing src attribute.

Discuss, Comment and Improve

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

comments powered by Disqus