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

Anselm Hannemann - Novolo Designagentur anselm at novolo.de
Thu Sep 1 01:20:32 PDT 2011


Am 31.08.2011 um 23:32 schrieb Karl Dubost:

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

How would you do this with a CMS? How to do with dynamic content when serving the CSS from a cookieless, static domain as it's best practice for performance.
From my point of view it can't work with just CSS. When you look to my proposed gist-solution you can see in history that I've already dealt with several other approaches.
Last is the only one that could really work that I know right now.


More information about the whatwg mailing list