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

Re: image width in percent

From: Jukka K. Korpela <jkorpela@cs.tut.fi>
Date: Wed, 05 Jun 2013 16:34:44 +0300
Message-ID: <51AF3E74.2070806@cs.tut.fi>
To: "www-validator@w3.org >> \"www-validator@w3.org\"" <www-validator@w3.org>
CC: bbecula@mac.hush.com
2013-06-05 16:16, David Dorward wrote:

> On 5 Jun 2013, at 8:15, bbecula@mac.hush.com
> <mailto: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
> <http://www.w3.org/TR/html5/embedded-content-0.html#attr-dim-width> 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:

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."

Received on Wednesday, 5 June 2013 13:35:21 UTC

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