W3C home > Mailing lists > Public > www-validator@w3.org > June 2013

Re: image width in percent

From: <bbecula@mac.hush.com>
Date: Wed, 05 Jun 2013 17:37:48 +0200
To: "Jukka K. Korpela" <jkorpela@cs.tut.fi>, "www-validator@w3.org www-validator@w3.org" <www-validator@w3.org>
Message-Id: <20130605153748.BBCA9E6739@smtp.hushmail.com>
Thank you.  My 45-year computer guru (Dick Miller of Miller
Microcomputer Services, Natick, MA) scolded me for not producing HTML
code that adjusted smoothly to screens of varying width. Percent
scaling seemed the perfect response. However, the term 'stretch' sent
me to Google, and sure enough, CSS seems to know something about
stretching images. I only have a hundred or so, scattered over 25
chapters: maybe I can find a validator-acceptable approach.

This is, incidentally, one thing that the W3C material is weak on. It
is good on announcing what doesn't work, but does not always tell me,
'here's what you need this week, instead of what used to work'.

Best,

BBecula
On 06/05/2013 at 3:35 PM, "Jukka K. Korpela"  wrote:2013-06-05 16:16,
David Dorward wrote:

> On 5 Jun 2013, at 8:15, bbecula@mac.hush.com
>  wrote:
>
>     I have images which are currently sized … with width in
percent.
>     This means that they scale nicely …
>     The validator insists that only 'px' should be used for widths,
>
>     What to do?
>
> First, check the spec
>  to
> confirm that the validator is right (which it is, for HTML 5):
>
>         Note: The dimension attributes are not intended to be used
to
>         stretch the image.
>
> Then use CSS for any presentation you wish to apply to your
document.

Alternatively, keep using the attributes and ignore these error 
messages, but double-check that you have entered them correctly.

Just because HTML5 drafts say that something is obsolete doesn't stop
it 
from working. In fact, the drafts require continued support in
browsers, 
though they formulate this somewhat cryptically:
http://www.w3.org/TR/html5/rendering.html#attributes-for-embedded-content-and-images

Unfortunately, HTML5 validators report as errors constructs that
belong 
to traditional HTML and are universally supported in browsers but just

don't conform to the philosophy/policy of HTML5 (and it's not the 
validators' fault - that's what HTML5 validators have been defined to 
do). This implies that they won't distinguish between such policy 
violations and actual errors, e.g. between width="50%" and width="50
%" 
(the latter probably won't work as intended). Incidentally, the latter

causes a somewhat cryptic variant of the error message: "Bad value 50
% 
for attribute height on element img: Expected a digit but saw
instead."

Yucca
Received on Wednesday, 5 June 2013 15:38:17 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 1 March 2016 14:18:08 UTC