Skip to main content

HTML Guide

Free site validation

Find out what web pages on your sites are affected by HTML issues.

Bad value X for attribute “(width | height)” on element “img”: Expected a digit but saw “.” instead.

The attributes width and height on an iframe expect a valid positive integer without any decimals.

Here’s an example of incorrect code where decimals are being used for dimension attributes:

<img src="photo.jpg" alt="Dog" height="602.88" width="800.2">

Corrected code without decimals:

<img src="photo.jpg" alt="Dog" height="603" width="800">

In the corrected code, the width and height values has been changed to a whole number, which conforms to the standard integer value expected by the W3C validator.

Learn more:

Related W3C validator issues