Re: aspect ratio as an attribute

On Thu, Dec 15, 2016 at 11:49 PM Adam van den Hoven <adam@littlefyr.com>
wrote:

>
> srcset also poses a problem (there's no reason to expect that a particular
> sized resource has the same aspect ratio as the rest) but if the
> aspect-ratio that alex proposed only describes the aspect ratio of the
> resource in src, an add aspect-ratio-set that matches src values in src set
> with an aspect ratio, we'd have a consistent solution. the hyphation in the
> attribute names are a pain so i'd use aspect and aspectset
>

That's really not required. There is reason to expect all resources inside
of srcset are of the same aspect ratio, as they are supposed to be
interchangeable, differing from one another only in dimensions and density
(and potentially compression quality). The browser can pick one or the
other based on heuristics. If you have different aspect ratios for
resources in different dimensions, you should use picture.


>
> So I'm suggesting (starting from the Mozilla docs on img
> <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#Example_4_Using_the_srcset_and_sizes_attributes>
> ):
>
> <img src="clock-demo-thumb-200.png"
>        aspect="0.75"
>       alt="Clock"
>       srcset="clock-demo-thumb-200.png 200w, clock-demo-thumb-400.png
> 400w, clock-demo-thumb-unknown.png 500w"
>       aspectset ="0.75, 1, default"
>       sizes="(min-width: 600px) 200px, 50vw">
>
> The logic being, if only aspect-ratio exists, it applies to all the src
> values (src and srcset). If defined aspect-ratio-source only applies to the
> srcset items. the default keyword is "we don't know what it its", ie the
> current behaviour. If there are more srcset values than aspectset values,
> either apply the last value, or the aspect value or maybe start over from
> the first and apply them in turn. Not sure what's best. (I'm agnostic about
> implying computation with 4/3 vs 1.333)
>
> But that's possibly making it a LOT more complex than necessary?
>

Yup

Received on Friday, 16 December 2016 06:18:36 UTC