About This HTML Issue
The value of the sizes attribute on an <img> starts with a literal " character, which can't begin a media condition or a CSS length.
sizes holds a comma-separated list of source sizes. Each one is an optional media condition followed by a length, as in (max-width: 600px) 100vw, and the last one is usually a plain length such as 600px. Lazy-loaded images can also start the list with auto. The quotes around an attribute value are HTML syntax, not part of the value. When an extra " ends up inside it, the validator tries to read the entry as a length, finds the quote where it expects a digit or a minus sign, and rejects the value.
The stray quote usually comes from one of two mistakes. In the first, the quotes around the value were HTML-encoded as ", often by a plugin or template that escaped markup a second time. " can't delimit an attribute, so the parser reads sizes="(max-width: as an unquoted value that stops at the first space. The rest of the list turns into stray attributes such as 600px) and 100vw,, which the validator reports separately, and the bad value in this message is only the first word, such as "(max-width: or "auto,. In the second, the value is wrapped in two sets of quotes, as in sizes='"100vw"', and the whole list is the bad value.
Browsers drop a sizes value they can't parse and fall back to 100vw. They then pick the srcset candidate meant for a full-width layout, which is often a larger file than the image slot needs.
The cause rarely affects sizes alone. If width, height or srcset on the same <img> also report a stray ", fix the code that writes the tag instead of editing each attribute.
Invalid example
<img
src="logo-600.png"
alt="Company logo"
srcset="logo-600.png 600w, logo-1200.png 1200w"
sizes="(max-width: 600px) 100vw, 600px">
Valid example
<img
src="logo-600.png"
alt="Company logo"
srcset="logo-600.png 600w, logo-1200.png 1200w"
sizes="(max-width: 600px) 100vw, 600px">
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?
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.
1K Weekly
1,000 monthly checks. Cancel anytime.
Get 1K Weekly →Join teams across 40+ countries