Percentage size inside a fit-content parent in quirk mode.
Categories
(Core :: Layout, defect)
Tracking
()
People
(Reporter: 350862273, Unassigned)
Details
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36
Steps to reproduce:
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
Actual results:
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.
Expected results:
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?
![]() |
||
Updated•3 years ago
|
Comment 1•3 years ago
|
||
The severity field is not set for this bug.
:mats, could you have a look please?
For more information, please visit auto_nag documentation.
Oops, sorry, should have let :mats decide the severity...
I think maybe it's trivial, for it only happens in quirk mode, when parent and child's height depend on each other.
:mats, please feel free to put a right severity on this:) Thanks!
Comment 3•1 year ago
|
||
Clear a needinfo that is pending on an inactive user.
Inactive users most likely will not respond; if the missing information is essential and cannot be collected another way, the bug maybe should be closed as INCOMPLETE
.
For more information, please visit BugBot documentation.
Description
•