Re: [css-images] Overconstrained image sizing and preserving aspect ratio: the object-sizing property

On 7 Feb 2014, at 3:07 pm, Tab Atkins Jr. <> wrote:

> On Fri, Feb 7, 2014 at 2:32 PM, Edward O'Connor <> wrote:
>>> I'm fine with "prefer-intrinsic", or something similar, for the one
>>> that just upgrades the power of an intrinsic aspect ratio.
>> Dean keeps typing "preserve-intrinsic," which might be a hint that
>> "preserve" is a better term than "prefer." *shrug*
> I'm thinking that we want the keyword for intrinsic AR and the keyword
> for calculated AR from width/height to be similar, and there's nothing
> to "preserve" in the latter.
> Let's stick with the image-resolution:from-image precedent, and do
> "from-intrinsic" and "from-dimensions" (or "from-size"?) as the two
> keywords?

First up, let me apologize for sending an email about CSS to the www-shadow-dom-fighting list.

Iíve got an implementation of this aspect-ratio/object-sizing thing mostly working (and it improves the cases we were hitting, so Iím fairly happy). Now I need an actual specification to conform to, and I think it might require a fair amount of patchwork into the existing CSS layout specs.

Tab, are you willing to expand your official blog post on aspect-ratio into something on

I think weíre agreed on:

1. Adding aspect-ratio: from-intrinsic; (and from-dimensions or from-size)
2. Having this value somehow interrupt the typical sizing algorithm to value the aspect-ratio over other sizing contraints (this is where it gets tricky, and will probably require a lot of review)

Iíve only implemented this for replaced elements, but Iím fine with it applying to everything, as long as someone writes the spec.

My current implementation is intentionally hacky, because I was trying to see if the behaviour was useful. I apply an override after the existing layout has happened, and reduce either width or height until we meet the specified aspect ratio. This means you can end up with something that is sized smaller than min-width or min-height, but Tabís blog post says that you should just ignore the aspect-ratio property in this case (do we really want this?)


Received on Monday, 10 February 2014 01:17:41 UTC