Re: New responsive images proposal

2013-09-27 23:24, Leif Halvard Silli wrote:

>> But there’s a different approach to implementing a similar idea. Just
>> use @media queries as currently defined and implemented, and use CSS
>> code like
> CSS is intended for stylesheets.

Obviously, yes, and style sheets are intended for making optional 
presentational suggestions, as opposite to structure (and, to a small 
degree, "semantics") and content, which are in the realm of HTML. An 
image is content, no doubt, unless it is specifically for decoration 
only. The different image formats and sizes and other versions of an 
image are styling, are they not?

>   And stylesheets are often external to
> the page and external to the element. CSS @-rules are not permitted
> inside the style attribute.

I don't think anyone in this discussion has favored the style attribute-

> A CSS approach means that each time you added an <img>, you would have
> to *also* add CSS - in a stylesheet that is external to the page.
>
> It is possible. But a *very* impractical way to solve the problem.

Separating presentation from content comes with a price. I think the 
price is sometimes too high (though most people involved in HTML5 don't 
seem to think so), but I don't think it's excessively high here.

So you add an image. If you add it in different versions, then you need 
to upload them all and write rules that specify which of them is used in 
which situation. Don't you think this is better suited for CSS work, 
rather than adding URLs of the different versions into HTML markup?

Now, there's the bandwidth issue. If your markup has just <img 
src=foo.png alt=bar>, then the browser more or less has to fetch 
foo.png. This should not matter much is foo.png is the smallest (in file 
size) version. But if it does matter, then you can just have <img 
alt=bar> (at the cost of having the alt text rendered instead of the 
image in browsers that do not support image replacement in CSS).

So my suggestion is: Use the *existing* technology of CSS image 
replacement, make it a separate "standard" (probably best a separate CSS 
recommendation, if the old WD does not look promising), and ask those 
browser vendors that have not implemented it to do so. This is a far 
more direct way. It does not exclude the addition of new attributes to 
HTML if they will be regarded as useful). But I think duplicating media 
dependency, already defined for CSS, in HTML would be confusing, 
especially to people who have take the Separation of Content from 
Presentation seriously.

-- 
Yucca, http://www.cs.tut.fi/~jkorpela/

Received on Saturday, 28 September 2013 12:02:23 UTC