[whatwg] The <pic> element

Anselm Hannemann Web Development info at anselm-hannemann.com
Sun Jun 3 23:02:55 PDT 2012


Am 01.06.2012 um 20:24 schrieb Kornel Lesiński:
> On 1 cze 2012, at 00:58, Anselm Hannemann Web Development <info at anselm-hannemann.com> wrote:
> 
>>> • Improved alternative text — allows structured fallback, avoids duplication.
>> This is where I do not agree. If you use MQ style with <source> you have a messy markup when writing alternative text inside the pic-element.
> 
> Since <source> is not read nor displayed, it doesn't matter. You can simply treat entire content as fallback. 

Sure but why? It is much more clearly to use the alt-attribute than using text between container and child elements IMO.

>> Alt-text should always be in an attribute and this would also be easier for screenreaders etc.
> 
> Structure is there to aid screen readers. 
> See http://lists.w3.org/Archives/Public/public-whatwg-archive/2012May/0216.html
> 
>>>   <pic src="portrait.jpg (orientation:portrait), landscape.jpg">alt text</pic>
>>> Selects image based on orientation of the device.
>> 
>> Why won't you do this with separate attributes?
>> Of course this is much shorter to write but it confuses the masses of developers because this is not a familiar HTML/CSS-pattern.
>> I would like to see it this style which is much more common:
>> 
>> <pic src-xs="small.jpg" media-xs="(max-width:15em)" src-xl="large.jpg" alt="alt text" title="title text"></pic>
> 
> I don't mind either way, but this seems a bit more noisier and less compact. 
> 
> <source> can be an option for authors who prefer separate attributes.

It is noisier of course but also clearer. I think this is a matter of personal preference.

>>> Embeds image at 192dpi (default scaling is 2x, possible to override with CSS).
>>> Same as `<pic src="image.jpg 2x">alt text</pic>` or
>>> `<img src="100x100px" width="50" height="50" alt="alt text">`.
>> Why is default scaling 2x? A default image should always be @1x, right?
> 
> We already have element for 1x images – <img>
> In the future 1x displays will be low-end minority and 2x will be the norm. It'll be annoying for designers that the default looks terribly and every page always needs the bad default overridden. 
> 
> I'm trying to avoid need for yet another opt-out from the past like doctype and <meta charset>.
> It'd be great if in 10-20 years all you had to do is type <pic src> instead of <img src> to get first-class support for hires images. 
> 
> To address Tab's concern the default is connected to image-resolution in CSS, so you can change it if you need to:
> 
> http://lists.w3.org/Archives/Public/public-whatwg-archive/2012May/0398.html

Yes but won't we at least dimiss img from our new code? I thought img is only the fallback…
And then we should always serve the minimum resolution first.
Regardless which resolution this minimal file has, it should be the @1x IMO.

Or am I missing something?

>>> (I'm not sure if `<source>` should allow microsyntax in `src` `<source src="b 3x">` instead of `resolution="3x"`)
>> I don't think so. It is much easier to have separate attributes. But what about extending the media-attr so we can write: 
>> 
>> <source src="b" media="3x">
> 
> Resolution descriptor is not a media query. I'd like to make that clear — it's not merely an abbreviation of min-device-pixel-ratio, it's a property of the image — more similar to width/height attributes. 

Fair enough :-) After thinking a bit about it it sounds better this way.

Cheers,
Anselm


More information about the whatwg mailing list