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

Re: aspect-ratio property

From: Brad Kemper <brad.kemper@gmail.com>
Date: Fri, 6 Jan 2012 08:33:05 -0800
Cc: Hugh Guiney <hugh.guiney@gmail.com>, Matthew Wilcox <elvendil@gmail.com>, www-style@w3.org
Message-Id: <2D5F98AA-941F-480E-A354-B1FB41F1B6A2@gmail.com>
To: Tab Atkins Jr. <jackalmage@gmail.com>

On Jan 5, 2012, at 3:45 PM, Tab Atkins Jr. wrote:

> On Thu, Jan 5, 2012 at 2:20 PM, Hugh Guiney <hugh.guiney@gmail.com> wrote:
>> 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.
> 
> So you'd just like a further note to that note, saying that videos are
> often not exactly 4:3 or 16:9 due to oddities in encoding standards,
> so beware when setting up ratios on dom elements depending on a video
> being the same size?

How about a video specific rule (maybe in HTML instead of in CSS), that if the video is sized via a CSS aspect-ratio, it will not distort the video, but rather add black bars. That would make it similar to a 16:9 movie playing on a 16:9 TV.
Received on Friday, 6 January 2012 22:05:31 GMT

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