W3C home > Mailing lists > Public > www-style@w3.org > June 2016

Re: Reserving aspect ratio for images

From: Una Kravets <una.kravets@gmail.com>
Date: Mon, 13 Jun 2016 20:05:08 -0500
Cc: www-style@w3.org
Message-Id: <848342C8-A782-4D57-A543-CE8641981689@gmail.com>
To: Oliver Joseph Ash <oliverjash@gmail.com>

> On Jun 12, 2016, at 12:42 PM, Oliver Joseph Ash <oliverjash@gmail.com> wrote:
> One idea I had was to add an aspectratio attribute to the img element (e.g. aspectratio="4:3"). Perhaps the source element could also receive an aspectratio attribute, so browsers know how to lay out the img element.

I agree —and I’ve seen this padding-bottom hack several times, especially for videos. I think this might be useful for other elements (not just video and img), too. Aspect ratio could be a CSS property with spaced values to remain in consistency with box-shadow and shorthand properties.

I.e. `preserve-ratio: <width-ratio> <height-ratio>`

.element {
  preserve-ratio: 4 3;

- Una
Received on Tuesday, 14 June 2016 01:05:37 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:09:03 UTC