This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 23244 - As srcset is defined right now, the 100w in this example currently means "a max width of 100 pixels." Right now srcset only allows for image selection based on max-width and pixels. Many web developer [...]
Summary: As srcset is defined right now, the 100w in this example currently means "a m...
Status: RESOLVED WONTFIX
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-14 01:37 UTC by contributor
Modified: 2013-11-13 19:24 UTC (History)
3 users (show)

See Also:


Attachments

Description contributor 2013-09-14 01:37:52 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/embedded-content-1.html
Multipage: http://www.whatwg.org/C#the-img-element
Complete: http://www.whatwg.org/c#the-img-element
Referrer: https://www.google.com/

Comment:
As srcset is defined right now, the 100w in this example currently means "a
max width of 100 pixels." Right now srcset only allows for image selection
based on max-width and pixels. Many web developers working with responsive
design use min-width media queries based on ems. A lot of concern about this
selector could be alleviated if we changed the synatx to something along the
lines of minw100px or maxw23em. It takes 3 extra characters to add the min or
max, but it more directly implies that this is not the width of the image, but
the width of the viewport, and it allows for both min and max width, which
would better match up with the layout switching taking place in stylesheets
via media queries. Allowing for em (which to be clear would be based off the
base font size defined in the browser, not as defined in any CSS), would again
allow the selection to properly match up with the media queries being used in
CSS stylesheets. Ems are often used to account for the fact that not all
devices use the 16px = 1em definition, and users (often due to eyesight)
sometimes change the browser base font size (even though browser zoom controls
may be available). To save characters, minw100 with no unit at the end could
be assumed to be px. And if it would further simplify things to use w100 as
the default equivalent of maxw100px, that could work too. This change would
allow a slight bit more verbosity, without all of the duplication in picture,
giving those web developers who want that verbosity for clarity's sake that
opportunity, as well as (more importantly) matching the selection criteria
with methods often used in CSS media queries. 

Posted from: 76.113.253.61 by mdrummond@mac.com
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.65 Safari/537.36
Comment 1 Ian 'Hixie' Hickson 2013-09-16 17:59:44 UTC
We can't use 'em's. The 'em' unit (and 'rem' unit) depends on style first having been resolved, which can only happen after style sheets are loaded, which happens after initial srcset image candidate selection has happened.

For min-width, see bug 20212. Please feel free to reopen that bug if you can provide further compelling information that should change the conclusion there.
Comment 2 Simon Pieters 2013-09-16 21:32:22 UTC
[[
Relative units in media queries are based on the initial value, which means that units are never based on results of declarations. For example, in HTML, the ‘em’ unit is relative to the initial value of ‘font-size’.
]]
http://dev.w3.org/csswg/mediaqueries4/
Comment 3 Ian 'Hixie' Hickson 2013-09-17 20:04:36 UTC
Just having a unit that means 16px is pointless, though.
Comment 4 Ian 'Hixie' Hickson 2013-11-13 19:24:19 UTC
I'm marking this WONTFIX, but really I'm just taking this off the bug list because there's an active discussion on the WHATWG list about this topic and I expect we'll end up with an entirely different feature than srcset="" eventually so this will just become moot.