Skip to content

[css-sizing] Define sizing of SVG Boxes with intrinsic aspect-ratio but no intrinsic size, in an auto-sized shrink-wrap parent #951

Closed
@FremyCompany

Description

@FremyCompany

If 'height' and 'width' both have computed values of 'auto' and the element has an intrinsic ratio but no intrinsic height or width, then the used value of 'width' is undefined in CSS 2.2.
However, it is suggested that, if the containing block's width does not itself depend on the replaced element's width, then the used value of 'width' is calculated from the constraint equation used for block-level, non-replaced elements in normal flow.
https://drafts.csswg.org/css2/visudet.html#inline-replaced-width

Browsers seem to follow the recommendation when it applies, but the undefined behavior is not 100% interoperable though most browsers (Edge / Chrome / Safari) seem to fallback to the "default object width" and compute the height using the aspect ratio.

https://jsfiddle.net/2y31ru8u/

Maybe time to define an actual behavior?
cc @dbaron @fantasai

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions