-
Notifications
You must be signed in to change notification settings - Fork 756
Closed
Description
https://drafts.csswg.org/css-sizing-4/#aspect-ratio
Usually, aspect-ratio is supposed to behave like a replaced element with that ratio. However, there is one behavior difference:
If a replaced element has a percentage width, the min-content size becomes 0:
https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/core/layout/layout_replaced.cc;l=912;drc=df8f58d9311eb29e65394e437a156b00fafc9a67;bpv=1;bpt=1
This is not the case with aspect-ratio, and when combined with contain-intrinsic-size this can lead to undesired effects, quoting from an email I got:
- Go to https://dvoytenko.github.io/aspect-ratio-css/#x-intrinsic-and-float
- Make the window smaller. Around innerWidth=300 you can see things pretty well.
- Observe that both "Native", "Emulated" and "Images" sections are identical and things are as expected.
- Now, in DevTools disable
max-width: 100%;from.intrinsic-and-float .outer-cell {}rule.- Observe that all "Emulated" and "Images" are the same. But "Native" now expanded to the full size in the contain-intrinsic-size.
Should this behavior be spec'd for aspect-ratio?