NEW 233032
Percentage size inside a fit-content parent in quirk mode
https://bugs.webkit.org/show_bug.cgi?id=233032
Summary Percentage size inside a fit-content parent in quirk mode
cathiechen
Reported 2021-11-12 01:11:51 PST
We found the behavior of the following case is different in browsers. The img and div size is 1x1 in Chrome. While the img and div size is 1xA in Safari and FireFox, where A is the screen height. Test case: ``` <div style="width:fit-content;height:fit-content;"> <img style="width: 100%; height: 100%" src="https://w3c-test.org/images/green-1x1.png"/> </div> ``` Or open https://output.jsbin.com/nodecov/quiet We have discussed this in https://bugs.chromium.org/p/chromium/issues/detail?id=1268427 According to https://quirks.spec.whatwg.org/#the-percentage-height-calculation-quirk The containing block is DIV. Then according to https://www.w3.org/TR/CSS22/visudet.html#the-height-property > If the height of the containing block is not specified explicitly (i.e., it depends on content height), and this element is not absolutely positioned, the used height is calculated as if 'auto' was specified. So the height of IMG is “Behaving as auto” (https://drafts.csswg.org/css-sizing-3/#behave-auto) So the IMG size should be 1x1, so as to DIV's. WDYT? Do we need a consistent here?
Attachments
Test Case (157 bytes, text/html)
2024-07-25 09:03 PDT, Ahmad Saleem
no flags
Radar WebKit Bug Importer
Comment 1 2021-11-19 01:12:20 PST
Ahmad Saleem
Comment 2 2024-07-25 09:03:24 PDT
Created attachment 471965 [details] Test Case
Note You need to log in before you can comment on or make changes to this bug.