Skip to main content
HTML Validation

Bad value X for attribute “srcset” on element “img”: Expected single descriptor but found extraneous descriptor Y at Z.

About This HTML Issue

Each image candidate in srcset is a URL followed by at most one descriptor, such as 800w or 2x, so any extra token before the next comma is an error.

Commas separate the candidates in srcset. The validator reads each candidate as a URL followed by one width descriptor (800w) or pixel density descriptor (2x). When a third token turns up, the message names it as the extraneous descriptor, and the part after at quotes the stretch of the value that ends with it. Browsers parse srcset with the same rules and skip that candidate.

An extraneous descriptor ending in =, such as loading=, usually means the closing quote of srcset is missing. The value runs on into the next attribute and stops at that attribute's opening quote, so loading= lands in the candidate list and the browser never sees a loading attribute. The validator also reports "No space between attributes" on the same element and rejects lazy" as an attribute name. Long values are left out of the message, which then starts with Bad value for attribute “srcset”.

If the extraneous descriptor is a file name, a comma is missing between two candidates. If it's a second descriptor, like 2x after 400w, keep only one: a candidate takes a width or a density, not both.

Invalid examples

The closing quote after 800w is missing, so loading= becomes part of the srcset value:

<img
  src="photo-400.jpg"
  srcset="photo-400.jpg 400w,
          photo-800.jpg 800w
  loading="lazy"
  sizes="(max-width: 600px) 100vw, 600px"
  alt="A mountain lake at sunrise">

Without a comma between the candidates, the second URL reads as a descriptor of the first:

<img
  src="photo-400.jpg"
  srcset="photo-400.jpg 400w photo-800.jpg 800w"
  sizes="(max-width: 600px) 100vw, 600px"
  alt="A mountain lake at sunrise">

Valid example

<img
  src="photo-400.jpg"
  srcset="photo-400.jpg 400w,
          photo-800.jpg 800w"
  loading="lazy"
  sizes="(max-width: 600px) 100vw, 600px"
  alt="A mountain lake at sunrise">

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