W3C home > Mailing lists > Public > www-validator@w3.org > April 2003

Re: "px" in the width/height attribute for IMG

From: Jukka K. Korpela <jkorpela@cs.tut.fi>
Date: Mon, 21 Apr 2003 17:35:02 +0300 (EEST)
To: www-validator@w3.org
Message-ID: <Pine.GSO.4.50.0304211730010.23617-100000@korppi.cs.tut.fi>

On Mon, 21 Apr 2003, David Håsäther wrote:

> I have seen some people including px when they specify width/height for
> an image like <img src="example.png" alt="" width="100px"
> height="100px">

It's a relatively common error. It's certainly an error, since it violates
the prose descriptions in the specification. Usually the error is caused
by the fact that people have difficulties in distinguishing between HTML
and CSS syntax. On the other hand, most (if not all) browsers simply
ignore the px part there.

> and the validator does not catch this fault.

That's correct, since the error is not a reportable markup error. It does
not violate the formal syntax specified by the DTD. Similarly,
width="whatever I put here" is valid, in the technical sense of
validation, but surely not correct. Since the width attribute can take
percentage values too (e.g., width="100%"), it wouldn't even be possible
to write a DTD that allows what the HTML specification allows and
disallows everything else. That is, the permitted format of values cannot
be described in SGML (or in XML).

-- 
Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/
Received on Monday, 21 April 2003 10:35:05 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 25 April 2012 12:14:08 GMT