Re: aspect-ratio property

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 UTC