[whatwg] <imgset> responsive imgs proposition (Re: The src-N proposal)

Maciej Stachowiak mjs at apple.com
Tue Nov 19 22:14:17 PST 2013


On Nov 19, 2013, at 4:17 PM, Laurent Perez <l.laurent.p at gmail.com> wrote:

> Hi
> 
> I was at the Paris RICG meetup in Paris, I understand the complexity of the
> responsive requirements.
> I'd like to propose the following pseudocode, building upon CSS4 range
> media queries.
> 
> @media (3dppx > resolution >= 2dppx),  (min-width: 320px) {
> .artdirection {
> background-image:url(high.png);
> background-position: center;
> background-repeat: no-repeat;
> min-width: 100%;
> }
> }
> 
> <img src="" class="artdirection"/>
> 
> What do you think ?

We've been discussing these kinds of CSS-based proposals. Is there a reason you picked 'background-image' instead of 'content'? As discussed earlier in the thread 'content is likely to work better in a variety of ways.

Also, what do you think about the attr(src-medium url) trick, which would let the image URLs be in the markup but the media queries in un-repeated CSS?

Regards,
Maciej

> 
> laurent
> 
> 
> 
> On Tue, Nov 19, 2013 at 2:19 AM, Tab Atkins Jr. <jackalmage at gmail.com>wrote:
> 
>> On Mon, Nov 18, 2013 at 5:08 PM, Maciej Stachowiak <mjs at apple.com> wrote:
>>> I see. It seems like it would be simpler to just define content on a
>> real element to have the existing WK/Blink behavior without saying
>> "replaced". It is not obvious why ignoring the element size is a useful
>> default behavior. But I suppose that discussion is out of scope here and
>> would better be discussed in a CSS-relevant forum.
>> 
>> Yeah, feel free to raise it in www-style if you're interested.
>> Otherwise, fantasai and/or I will take care of it in due time, when we
>> have time for it.
>> 
>>> For the sake of curiosity: is there any reasonably accurate current
>> draft that describes what 'content' is supposed to do on a non-pseudo
>> element?
>> 
>> Nope.
>> 
>>> The most recent reference I could find is <
>> http://www.w3.org/TR/css3-content/> but that hasn't been updated in a
>> while. It says "If the computed value of the part of the 'content' property
>> that ends up being used is a single URI, then the element or pseudo-element
>> is a replaced element. The box model defines different rules for the layout
>> of replaced elements than normal elements. Replaced elements do not have
>> '::before' and '::after' pseudo-elements; the 'content' property in the
>> case of replaced content replaces the entire contents of the element's
>> box." But I can't tell if that matches what you say or is the opposite.
>> 
>> Right, Content is out-of-date and hasn't been sanity checked.  Don't
>> let the recent-ish date fool you; it's just a stripped-down version of
>> the older 2003 draft, and the remaining parts haven't been seriously
>> gone over yet.
>> 
>> ~TJ
>> 
> 
> 
> 
> -- 
> http://laurentperez.fr
> J2EE tips and best practices




More information about the whatwg mailing list