W3C home > Mailing lists > Public > www-style@w3.org > August 2012

[CSS3-Images] Object-fit's behaviour compared to background-size

From: Steve Workman <steve.workman@gmail.com>
Date: Mon, 27 Aug 2012 20:53:25 +0100
Message-ID: <CAJkFa-webziROp_TxFHGf1EkeHKzwLq62R6x0Jej0r4jLWwohw@mail.gmail.com>
To: www-style@w3.org
Cc: Chris Mills <cmills@opera.com>
Hi all,

I'm currently writing a polyfill for Object-fit [
https://github.com/steveworkman/jquery-object-fit] and have been discussing
the implementation with Chris Mills (cc'd). From Opera's implementation,
and from my initial understanding of the property, I believed that
object-fit (cover|contain) would behave identically to background-size
(cover|contain) because of the identical syntax and very similar way that
they are explained in their specs. After some discussion, it's clear that
unless a height or width is specified, object-fit will have no effect on
the dimensions of the resulting image.

I'm simply wondering why it wouldn't behave as background-size does.

For example, given a parent block-level element with specified width, a
child image with height and width set to auto and object-fit set to contain
does not contain the image, instead leaving it at it's natural size. If
this were a background-image instead, it would re-size to fit the container
that it has been applied to.

I propose that the spec be amended to provide for times when the
width/height of the image is set to auto, to behave more like
background-size.

Let me know what you think,

Steve
Received on Monday, 27 August 2012 19:53:53 GMT

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