Re: 'image-fit' vs preserveAspectRatio


------- Forwarded message -------
From: "Erik Dahlström" <>

> Hi Simon,
> I know little about SVG, so maybe someone else will help out if I  
> misspeak.
>> The CSS property allows the same precision as
>> 'background-position' for positioning, while SVG has less
>> precision. What are the use cases for more precision?
> I think the greater precision for positioning was driven more by a  
> desire to align with existing CSS syntax than from identified use  
> cases.  The greater flexibility may not afford significant advantage to  
> CSS authors.

Svg might be "less flexible" for positioning if you use preserveAspectRatio, but I wouldn't call it "less precision". Anyway...

>> The CSS spec allows the image to go outside of the layout box
>> with 'overflow:visible; image-fit:cover'. What's the use case
>> for this?
> This is more driven by the CSS box model than by use cases, I believe.   
> Images can extend beyond their height/width boxes, and overflow is the  
> mechanism to control that.  The 'image-fit' specification just uses the  
> existing model.  (I don't think SVG has a similar overflow model, does  
> it?)

Svg supports 'overflow' on elements that establish viewports, which among other things includes foreignObject. The name 'image-fit' may not be so appropriate for that case. See

I would ask what the CSS WG thinks should happen when using 'image-fit' on <iframe>, <object> and <embed>, both in case it references a raster image, and when it doesn't (e.g an svg, or some html, or a plugin).

>> Previously, the CSS spec had the same keywords as SVG. What's
>> the reason for the change?
> The keywords were initially taken from SMIL 1.0, but it was felt that  
> the functionality was different enough that we should use different  
> names to prevent confusion.  Also, the CSS group felt that the previous  
> keywords weren't as descriptive as they could be.

The SVG WG seemed to be ok with a new property, and could adopt it for use in SVG too, but 'image-fit' wasn't seen as a general enough name.



Simon Pieters
Opera Software

Received on Friday, 20 March 2009 14:45:53 UTC