RESOLVED FIXED289876
`position: absolute` with inner `max-height: 100%` makes `height: max-content` resolve to 0
https://bugs.webkit.org/show_bug.cgi?id=289876
Summary `position: absolute` with inner `max-height: 100%` makes `height: max-content...
Benoît Rouleau
Reported 2025-03-16 15:35:26 PDT
Created attachment 474584 [details] Test case See the attached test case and compare the result between Chrome, Firefox, and Safari. Only Safari doesn't show the red background (indicating that the box has a 0 height). What makes me think it's a bug is that if you remove the `position: absolute`, the height is the same as other browsers; I don't think the height of an element should ever be affected by whether it is absolute-positioned (unless it's the child of a flex or grid container that stretched it, but it's not the case here).
Attachments
Test case (574 bytes, text/html)
2025-03-16 15:35 PDT, Benoît Rouleau
no flags
Patch (20.49 KB, patch)
2026-04-11 15:08 PDT, alan
no flags
[fast-cq]Patch (25.85 KB, patch)
2026-04-11 15:23 PDT, alan
no flags
Karl Dubost
Comment 1 2025-03-16 22:25:26 PDT
confirmed. Firefox and Chrome have a red background <div class="box"> <div class="box-inner">This text should have a red background.</div> </div> .box { background-color: red; height: max-content; position: absolute; } .box-inner { max-height: 100%; } # HEIGHT Safari: body: 0 .box: 0 .box-inner 0 Firefox: body: 0 .box: 19.2px .box-inner: 19.2px Chrome: body: 0 .box: 18.5 .box-inner 18.5
Radar WebKit Bug Importer
Comment 2 2025-03-18 11:20:19 PDT
Yulun Wu
Comment 3 2026-03-03 14:49:32 PST
alan
Comment 4 2026-04-11 15:08:18 PDT
alan
Comment 5 2026-04-11 15:23:01 PDT
Created attachment 479023 [details] [fast-cq]Patch
alan
Comment 6 2026-04-11 15:24:18 PDT
*** Bug 308648 has been marked as a duplicate of this bug. ***
alan
Comment 7 2026-04-11 17:07:59 PDT
*** Bug 260461 has been marked as a duplicate of this bug. ***
EWS
Comment 8 2026-04-13 07:09:23 PDT
Committed 311084@main (9bff4dfd6167): <https://commits.webkit.org/311084@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 479023 [details].
Sammy Gill
Comment 9 2026-04-22 15:21:40 PDT
Submitted web-platform-tests pull request: https://github.com/web-platform-tests/wpt/pull/59425
Note You need to log in before you can comment on or make changes to this bug.