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

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 UTC