W3C home > Mailing lists > Public > www-style@w3.org > January 2012

Re: aspect-ratio property

From: Hugh Guiney <hugh.guiney@gmail.com>
Date: Thu, 5 Jan 2012 17:20:10 -0500
Message-ID: <CAEHyr+YU9tLu74yh-te9ByeJPVnON64WAuf9pYNDzsMrdeNHtQ@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: Matthew Wilcox <elvendil@gmail.com>, www-style@w3.org
Hope this isn't too divergent; spin-off the thread if necessary, but I
just read your proposed spec Tab (http://www.xanthir.com/blog/b4810),
and have some comments.

> You can use it to, for example, require that an HTML <video> element is as wide as its parent element at all times, but maintain a 4:3 ratio.

> However, several common ratios are usually expressed as fractions or explicit ratios, such as "16 by 9". These can be easily expressed using the calc() function, like aspect-ratio: calc(16/9);.

The problem with these is that in the video world, aspect ratio is a
lot more complicated. When somebody says "4:3" or "16:9", all you can
really be sure of what they mean is "frame size that is nearly as tall
as it is wide" and "frame size that is noticeably wider than it is
tall", respectively. The aspect ratios of video described in these
terms, more often than not aren't literally 4:3 or 16:9, due to
varying pixel aspect ratio dimensions.

I explained this problem in some detail on WHATWG a few years back
(first reply block):
http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-December/024541.html

The problem is, if an author has a 720x480 pixel video, and specifies:

    max-height: 480px;
    aspect-ratio: calc(16/9);

What do they get? The blind mathematics are simple, but the correct
square-pixel width could be 853, 854, 856, 864, 873, or 875 depending
on the video specification being observed. And that's just on the
"NTSC" side; there are still other definitions for PAL-area video.
Most authors and even video professionals are oblivious to these
conflicting definitions so even if there were a way to specify the
standard manually it wouldn't be used.

Thus I think the best solution would be a rewording of the spec that
states the value of aspect-ratio is interpreted literally; that
depending on the video standard, the shorthands 4:3 or 16:9 may not
produce the correct ratio.
Received on Thursday, 5 January 2012 22:21:06 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:48 GMT