Skip to main content

HTML Guide

Bad value “X%” for attribute “width” on element “img”: Expected a digit but saw “%” instead.

<img> elements accept a width attribute to specify the size in pixels. This value can only be an integer, it should not contain units or %. If you need to specify a percentage width, you can do that with CSS:

<img src="photo.jpg" alt="red car" style="width:100%;">

Related W3C validator issues