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

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

The `height` attribute of an `<object>` takes a number of CSS pixels written as digits only, so a unit such as `px` in `height="800px"` makes the value invalid.

The HTML standard defines `width` and `height` on `<object>` as dimension attributes, whose value must be a valid non-negative integer. The validator reads the value from the left and stops at the first character that isn't a digit. In `800px` that is the `p`, and `pt` or `pc` stop at the same letter. Other units are reported by their first character (`v` in `80vh`, `e` in `40em`). A percentage such as `100%` gets its own error, about the `%` sign.

Browsers read the leading digits and drop the rest, so `height="800px"` already renders 800 pixels tall. Deleting the unit leaves the layout as it is. The attribute can only express pixels, though. For a height in viewport units, ems or a percentage of the container, remove the attribute and set the CSS `height` property instead.

## Invalid example

```html
<object data="/docs/annual-report.pdf" type="application/pdf" width="600" height="800px"></object>
```

## Valid example

```html
<object data="/docs/annual-report.pdf" type="application/pdf" width="600" height="800"></object>
```

To size the object relative to the viewport, use CSS:

```html
<object data="/docs/annual-report.pdf" type="application/pdf" style="width: 100%; height: 80vh;"></object>
```
