Re: image width in percent

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:
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 13:35:21 UTC