[whatwg] add html-attribute for "responsive images"

Karl Dubost karld at opera.com
Wed Aug 31 14:32:37 PDT 2011


Anselm,
(setting reply-to on www-style)

Seen this today, to remind people that it is not just 
something up in the air. People need it.
http://www.webmonkey.com/2011/08/speed-up-your-responsive-designs-with-adaptive-images/

I wonder if it could be handled by CSS in fact. 
I guess Anselm, you could ask there.
On the www-style mailing-list, Charles proposed [1]

	content: url(img.jpg) replaced;

I'm not sure I fully understand the proposal 
but we can imagine something that could fit nicely 
with the CSS Generated Content Module Level 3 [2]

<img class="responsive" src="http://example.org/foo" alt="wiizz"/>

and then the CSS


@media  screen and (min-width:550px) and (max-width:960px) {
   img.responsive {
	url(http://example.org/foobis) replaced;}
   }
@media  screen and (min-width:240px) and (max-width:549px) {
   img.responsive {
	url(http://example.org/footer) replaced;}
   }


[1]: http://www.w3.org/mid/4E5D4A46.7000103@jumis.com
[2]: http://dev.w3.org/csswg/css3-content/#replacedContent


-- 
Karl Dubost - http://dev.opera.com/
Developer Relations & Tools, Opera Software



More information about the whatwg mailing list