Skip to main content
HTML Validation

Bad value X for attribute “height” on element “img”: Expected a digit but saw “"” instead.

About This HTML Issue

The height attribute of an <img> has a literal " character inside its value, which may only contain digits.

height takes a non-negative integer such as 109, with no quotes, units or spaces. The quotes around an attribute value are HTML syntax, not part of the value. When an extra " ends up inside it, the validator stops at that character and rejects the value.

A value that starts with the quote, such as "109", usually comes from one of two mistakes. In the first, the quotes around the value were HTML-encoded as &quot;, often by a plugin or template that escaped markup a second time. &quot; can't delimit an attribute, so the parser reads height=&quot;109&quot; as an unquoted value and decodes both references into literal quotes. In the second, the value is wrapped in two sets of quotes, as in height='"109"'.

A value that ends with the quote, such as 109", means the opening quote is missing (height=109") or the quotes don't match (height='109"'). Without an opening quote, the validator also reports “"” in an unquoted attribute value.

Browsers read 109" as 109, so that case often looks fine. A value that starts with the quote fails to parse, and the browser ignores height. Without it, the browser can't work out the image's aspect ratio before the file loads, so it reserves no vertical space and the content below shifts once the image arrives.

The cause rarely affects height alone. If width, srcset or sizes 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.png" alt="Company logo" width="600" height=&quot;109&quot;>
<img src="logo.png" alt="Company logo" width="600" height=109">

Valid example

<img src="logo.png" alt="Company logo" width="600" height="109">

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