Re: [css-flexbox] Making percentage margins/padding consistent with Grid

On Fri, Mar 15, 2013 at 5:57 AM, James Holderness <j4_james@hotmail.com> wrote:
>> What are the use-cases for percentage margin/padding? The block approach
>> is
>> easier to implement. I agree that flexbox and grid should be consistent
>> with each other, but unless we have actual use-cases, I don't see the
>> benefit (beyond theoretical purity) of diverging from the block behavior.
>
> The most common use-case I'm aware of is for creating blocks with a specific
> aspect ratio that can still scale to fit the width of their container. For
> example, you set the width to 100%, the height to 0, and padding-top to 75%,
> and your block will fill the width of its container while retaining a
> constant 4:3 aspect ratio.
>
> Obviously this relies on the current block behaviour. I don't know whether
> there are perhaps better ways of accomplishing the same thing with flexbox
> and grid.

The better way is for us to add the aspect-ratio property, like how I
have it documented on my blog: <http://www.xanthir.com/blog/b4810>
(This proposal, as written, won't work, but it's close.)

~TJ

Received on Friday, 15 March 2013 16:18:38 UTC