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

> Canonical HTML version: https://rocketvalidator.com/html-validation/bad-value-x-for-attribute-height-on-element-img-expected-a-digit-but-saw-quote-instead
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

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

```html
<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

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