W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2012

Re: [whatwg] srcset isn't future-friendly to screen size differences

From: Fred Andrews <fredandw@live.com>
Date: Fri, 7 Sep 2012 11:25:21 +0000
Message-ID: <BLU002-W938A2FC4961081289A871FAAAF0@phx.gbl>
To: Simon Pieters <simonp@opera.com>, WHATWG List <whatwg@whatwg.org>

> From: simonp@opera.com
> On Fri, 07 Sep 2012 06:07:30 +0200, Fred Andrews <fredandw@live.com> wrote:
> >
> >
> >> From: jackalmage@gmail.com
> > ...
> >> I'm not sure how best to solve this, but John Mellor suggested
> >> allowing the specification of the image's native dimensions somehow.
> >> That way, the browser could know that the 1600.jpg image is
> >> appropriate to serve as an 800px wide high-dpi image, or a 1600px wide
> >> low-dpi image.
> >
> > John has a proposal here:  
> > http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2012-August/036958.html   
> > e.g. '<img srcset="320x120, 320.jpg 1x, 640.jpg 2x, 1280.jpg 4x,  
> > 2560.jpg 8x">' . As I understand it John's proposal only declares the  
> > image sizes and is not intended for making a selection based on density  
> > or screen size directly?
> If what's necessary here is to declare the intrinsic dimensions, why not  
> use the width="" and height="" attributes for this? (They can be  
> overridden with CSS if you want e.g. 100% width.)

The aim is to declare the available raw image sizes so that the browser can choose the most appropriate image to use.  That is, the image 320x120.jpg is 320 pixels wide and 120 pixels high, the image 640.jpg is 640 pixels wide and 240 pixels high, etc.  This is not intended to specify the CSS pixel size the that image will occupy.  The width="" and height="" attributes may well be used to specify the CSS pixel size of the image in the layout.  If the width and height of the <img> element are not given then the browser will need to consult the raw image size and I presume John intends the first size to be the CSS pixel size in this case - for higher density screens the browser could then choose a higher resolution image from the set.

There are a few other proposals with a similar intent.


Received on Friday, 7 September 2012 11:25:51 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:45 UTC