Skip to main content
HTML Validation

Bad value “Xpx” for attribute “width | height” on element “img | iframe”: Expected a digit but saw “p” instead.

About This HTML Issue

The width and height attributes on <img> and <iframe> elements expect a digit to indicate the number of pixels. Ensure that this attribute contains only digits.

For example:

<!-- This is invalid because width is not a digit -->

<img width="225px" height="100px" alt="cat" src="cat.jpg" />

<!-- This is valid -->

<img width="225" height="100" alt="cat" src="cat.jpg" />

Last reviewed: October 27, 2022

Was this guide helpful?

Find issues like this automatically

Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.

Ready to validate your sites?
Start your free trial today.