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

Bronislav Klučka Bronislav.Klucka at bauglir.com
Wed Feb 8 02:41:47 PST 2012



On 8.2.2012 11:23, Benjamin Hawkes-Lewis wrote:
> 2012/2/8 Bronislav Klučka<Bronislav.Klucka at bauglir.com>:
>>
>> On 8.2.2012 10:59, Anselm Hannemann - Novolo Designagentur wrote:
>>>> Hi,
>>>> I think that while talking about responsive image, introducing element
>>>> that would choose image based on media-query, we should explore more generic
>>>> approach... any media
>>>>
>>>> <media media="all">
>>>> <video media="support: video">
>>>> <source src="blabla.ogg" type="video/ogg" media="min-resolution: 300dpi"
>>>> />
>>>> <source src="blabla_small.ogg" type="video/ogg"  media="max-resolution:
>>>> 150dpi" />
>>>> <source src="blabla.mp4" type="video/mp4"  media="min-resolution: 300dpi"
>>>> />
>>>> <source src="blabla_small.mp4" type="video/mp4" media="max-resolution:
>>>> 150dpi" />
>>>> </video>
>>>>
>>>> <picture>
>>>>    <src href="small.jpg" alt="a headshot of Bob
>>>> Flemming"media="min-width:320" />
>>>>    <src href="medium.jpg" alt="a head and shoulders shot of Bob Flemming"
>>>> media="min-width:480" />
>>>>     <src href="large.jpg" alt="a full body portrait of Bob Flemming"
>>>> media="min-width:640" />
>>>> </picture>
>>>>
>>>> <img src="blabla.png" alt="blabla" />
>>>> </media>
>>>>
>>>> I can imagine e.g. car presentation using this approach, with preferences
>>>> based on tree position of media content.
>>>>
>>>> BTW adding media attribute to video (video ->    source) element might be
>>>> useful as well... type tells a lot, but not all regarding responsive media
>>>> content
>>> Why do we actually need this new wrapper element? I don't see any reason
>>> for this.
>> How else would you know what the alternatives are?
> Another option to containment would be referencing: add a @srclist
> attribute on "img" that points to a<srclist>  container of "src"
> elements.
>
> Compare @list and @datalist:
>
>      http://www.whatwg.org/specs/web-apps/current-work/multipage/common-input-element-attributes.html#attr-input-list
>
>      http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html#the-datalist-element
>
> --
> Benjamin Hawkes-Lewis

Well such idea would be more messy regarding reading the code, but 
definitely have the advantage  of possible reuse of such set.

Brona



More information about the whatwg mailing list