Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5 validation of image tags

Am I not allowed to specify the unit for width and height on <img> tags in HTML5?

I am getting this error from the validator:

Bad value 122px for attribute width on element img: Expected a digit but saw p instead.

like image 926
Francisc Avatar asked Sep 12 '11 20:09

Francisc


3 Answers

Drop the 'px' part. Use only non-negative integers.

like image 58
George Cummins Avatar answered Nov 04 '22 23:11

George Cummins


Move the percentage width from the html tag to the in-line style:

For example:

Change this line

<iframe width="100%" height="588" style="border:none; background:transparent; overflow:hidden;" />

to this:

<iframe height="588" style="border:none; background:transparent; overflow:hidden; width:100%;" />

then it will validate...

like image 6
Zain Avatar answered Nov 04 '22 23:11

Zain


just write 122 instead of 122p

like image 4
Shehzad Ahmed Avatar answered Nov 05 '22 00:11

Shehzad Ahmed