Skip to main content
HTML Validation

Attribute “src” without an explicit value seen. The attribute may be dropped by IE7.

About This HTML Issue

The src attribute appears as a bare name, with no = and no value, which leaves the element with an empty URL.

HTML lets you drop the value only on boolean attributes such as disabled, hidden or async, where having the attribute at all is what counts. src holds the address of the image, script, frame or media file to load, so it needs one. The parser reads <img src> as <img src="">, and the validator pairs this warning with an error on the same element saying the src value must be non-empty. The IE7 note comes from a time when that browser could drop attributes written this way. IE7 is long gone, but the empty URL still breaks the element.

A browser has nothing to fetch for an empty src. An <img> loads no image and fires its error event, and a <script> fires error without running. The bare src often comes from a lazy-loading script that keeps the real address in data-src until the image scrolls into view, or from a template whose image variable printed nothing.

Put the real URL in src. The native loading="lazy" attribute defers the download without any script. If there's no image to show, leave the <img> out of the page instead of printing it with an empty src.

Invalid example

<img src alt="Our team" data-src="/images/team.jpg" class="lazyload">

Valid example

<img src="/images/team.jpg" alt="Our team" loading="lazy">

Find issues like this automatically

Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.

Help us improve our guides

Was this guide helpful?
🌍 Trusted by teams worldwide

Validate at scale.
Ship accessible websites, faster.

Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.

Scheduled Reports
API Access
Open Source Standards
€5 / week

1K Weekly

1,000 monthly checks. Cancel anytime.

Get 1K Weekly →

Join teams across 40+ countries