W3C home > Mailing lists > Public > www-style@w3.org > May 2010

Re: suggestion: fixed-aspect-ratio CSS rule for block elements

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Thu, 6 May 2010 14:56:22 -0700
Message-ID: <g2mdd0fbad1005061456h88ec6a3ev93711f6c37ade3df@mail.gmail.com>
To: Daniel Glazman <daniel.glazman@disruptive-innovations.com>
Cc: julien.cayzac@gmail.com, www-style@w3.org
On Thu, May 6, 2010 at 2:49 PM, Daniel Glazman
<daniel.glazman@disruptive-innovations.com> wrote:
> Le 06/05/10 19:23, Tab Atkins Jr. a écrit :
>
>> Is there any reason for this?  I'd think it would just use the normal
>> rules for resolving width/height.  Whichever one normally takes
>> precedence does so, and then aspect-ratio is consulted to constrain
>> the other one.  If we wanted to change which dimension was used as the
>> "primary" input for the sizing algo, we should do that separately
>> rather than shoving it into a nominally unrelated property.
>
> Televisions preserving the aspect-ratio of the image on a screen of
> another aspect-ratio (4/3 on a 16/9 tv for instance) often offer
> the two modes (black strips around height preservation or clipping of
> width preservation.

You can do that by just setting an aspect ratio along with height:100%
and width:auto, though.  (When that doesn't work, it's a failing of
the current CSS treatment of percentages in height, which we discussed
at the ftf.)

In addition, actual replaced elements like <video> can already adjust
their sizing in those ways while preserving aspect-ratio, via
object-fit:contain or cover.

~TJ
Received on Thursday, 6 May 2010 21:57:14 GMT

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