Re: [csswg-drafts] How to stretch an SVG image? (the default `object-fit: fill` behaves similarly to `object-fit: contain`) (#12378)

> Try removing the viewBox from the svg.

Huh, [that works](https://codepen.io/benface/pen/GgJYGKE). To be honest, I didn't even know it was valid to have a SVG without a `viewBox`. I guess there's an implicit viewbox based on the coordinates of the elements in the SVG or something? Anyway, I still think it's very strange that the consumer of an image – who may not have any control over the image file – cannot size it the way they want in CSS. I feel like there should be a way to stretch _any_ image regardless of their format, even if (for webcompat reasons) it requires a new value (e.g. `object-fit: stretch`) and `object-fit: fill` keeps behaving inconsistently.

-- 
GitHub Notification of comment by benface
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12378#issuecomment-2992439119 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 20 June 2025 18:15:01 UTC