Revisiting aspect ratios in sizes

Back in 2014, Steve Caflin started an interesting thread on finding some
way to tell the browser the size of the image in the page for the purposes
of assisting with layout.[^1]

The conversation led to two tickets in Github about intrinsic
dimensions[^2] and how sizes only works with width-constrained images.[^3]
Conversations on both tickets have subsided and issue #86 was explicitly

I would like to reopen this conversation. In particular, we've seen an
increased emphasis on providing old school width and height attributes to
avoid the page jumping around.

AMP Pages explicitly require height and width declarations for this
reason.[^4] Owen Cambell-Moore's UI recommendations for Progressive Web
Apps also state you should avoid pages jumping around by declaring height
and width.[^5]

The problem was also recently raised on the www-style list[^6] where Rachel
Nabors[^7] among others described how this is a generalized problem for
more than simply images.

I believe we need to strongly consider two actions:

1. Prioritize adding aspect ratio information to sizes (or adding a aspect
2. Considering extending the sizes (and an aspect attribute if one exists)
to be available to other elements that provide similar layout problems in
responsive designs.

With sizes, we've provided half of what the browser needs to reserve the
size of the image in the page. If the browser knew the aspect ratio, it
could calculate the other half. Let's find a way to make this happen.




+1 (503) 290-1090 o | +1 (503) 502-7211 m | | @grigs

Received on Wednesday, 21 September 2016 05:45:44 UTC