Re: [css3-box] providing an aspect-ratio for a box (Re: suggestion: fixed-aspect-ratio CSS rule for block elements)

On Mon, Sep 20, 2010 at 10:17 PM, Andrew Fedoniouk
<andrew.fedoniouk@live.com> wrote:
> Just in case, I am using the following construction:
>
> div
> {
>  width:25%;
>  height: width(30%);
> }
>
> So height will be 30% of computed value of the width.
>
> The 'width(percentage)' is a kind of function that describes base/source of
> percentage operation.
>
> There are logical problems (chicken-egg alike) with aspect-ratio or the like
> properties.
>
> E.g. it is not clear what to do with this:
>
> div
> {
>  width:25%;
>  height:25px;
>  aspect-ratio:0.3;
> }
>
> and meaning of the following is not clear too:
>
> div
> {
>  height:25%;
>  aspect-ratio:0.3;
> }
>
> That is actually even prohibited configuration by the CSS nature:
> compute-widths-and-then-heights.
>
> So the aspect-ratio is a value of the height property and only the height
> and definitely not a separate property.

No, aspect-ratio is not just a value of the height.  For one thing,
when you have horizontal block progression, width becomes dependent on
height.  For two, if you have an explicit height and an aspect ratio,
it's unambiguous what the width should be.

Per the previous discussion on this topic, it would work like this:

1. If both width and height are not 'auto', then aspect-ratio has no effect.
2. If one of width and height are 'auto' and the other is not 'auto',
then the 'auto' one is computed by using the other dimension and the
aspect-ratio.
3. If both width and height are 'auto', then whichever dimension is
calculated first is calculated normally (width, in normal block flow),
then aspect-ratio is used to calculate the other dimension.

Likely, aspect-ratio would only be defined for normal flow.  I suspect
that it wouldn't play nicely with tables.

~TJ

Received on Tuesday, 21 September 2010 18:12:57 UTC