W3C home > Mailing lists > Public > public-html-comments@w3.org > November 2011

Re: Image width specification in html5

From: Michael[tm] Smith <mike@w3.org>
Date: Mon, 21 Nov 2011 17:10:44 +0900
To: David Swindlehurst <davidms@uwclub.net>
Cc: public-html-comments@w3.org
Message-ID: <20111121081043.GA75450@sideshowbarker>
David Swindlehurst <davidms@uwclub.net>, 2011-11-20 13:55 +0000:

> <div class="?"><img src="image.png" alt="ancient grey-haired awkward person"
> width="25%" /></div>
> results in an error - the Validator expects an absolute number (of pixels!).
> Fixing image width like this prevents correct rendering of the page in any
> size of display different from the writer's original. Although there is a
> mass of insignificant discussion in the current Specification about the
> "alt" tag, there is no mention of image sizing at all, which seems to me to
> be far more important. Does the Spec need revising, or is the Validator
> wrong in expecting an absolute number?

The relevant part of the spec is this:

  Author requirements: The width and height attributes on img, iframe,
  embed, object, video, and, when their type attribute is in the Image
  Button state, input elements may be specified to give the dimensions of
  the visual content of the element (the width and height respectively,
  relative to the nominal direction of the output medium), in CSS pixels.
  The attributes, if specified, must have values that are valid
  non-negative integers.

"25%" is not an integer, so the validator behavior conforms to the spec in
correctly reporting an error for it.

See also the last part of the "Changed Attributes" section of the "HTML5
differences from HTML4" document, which says:

  "The width and height attributes on img and other elements are no longer
  allowed to contain percentages."


Michael[tm] Smith
Received on Monday, 21 November 2011 08:10:51 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:26:28 UTC