Re: object-fit/view-box for element content

I would love to see more movement on this. I think the lack of this feature
(defining an aspect ratio for an element) contributes to one of the worst
UX problems on the web: page jumping as content loads. It's not the case
that authors can fix it easily, they have to reach for hacks like the
padding bottom trick.

Take the simple use case of a fluid img—there is no simple way to preserve
space of the correct aspect ratio, so most content authors don't. Thus,
page jumping prevails.

I suppose you could fix the fluid img case by adding a view box?

I have another use case: I want to use the <picture> element for art
direction, but I also want to ensure space is reserved in the layout before
the images are downloaded, to avoid a disorienting page jump for the user
once they load. The aspect ratio for each source will be different. The
only way you can achieve both of these (art direction + reserving space in
layout) right now is by ditching the <picture> element to instead use two
imgs, each wrapped with a the famous "padding bottom" hack to reserve
spacing whilst they load. How would the view box solution work for that?
Would you add a view box to each source element?

Received on Wednesday, 18 May 2016 08:37:35 UTC