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

Re: aspect-ratio property

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 6 Jan 2012 14:06:47 -0800
Message-ID: <CAAWBYDDetc+b+9=NiY3kj1_Tkp09i+k9vJ9PsgbS6wopswiJmw@mail.gmail.com>
To: Brad Kemper <brad.kemper@gmail.com>
Cc: Hugh Guiney <hugh.guiney@gmail.com>, Matthew Wilcox <elvendil@gmail.com>, www-style@w3.org
On Fri, Jan 6, 2012 at 8:33 AM, Brad Kemper <brad.kemper@gmail.com> wrote:
> 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.

This is actually already handled for <video> specifically.  <video> is
a replaced element, and its content (the video itself) has an
intrinsic aspect-ratio (which would be unaffected by the
'aspect-ratio' property, which applies to the element rather than the
contents).

<video> uses "object-fit:contain" in the HTML stylesheet to ensure
that it gets boxed rather than distorted when the ratio of the element
is different than the ratio of the video.  "background:black" could
then be added to specifically make the bars black, if desired.

~TJ
Received on Friday, 6 January 2012 22:14:17 GMT

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