Skip to main content

HTML Guide

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

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" />

Related W3C validator issues