Bug 147953 - Percentage padding of absolutely positioned element being calculated based on parent's content width instead of containing block.
Summary: Percentage padding of absolutely positioned element being calculated based on...
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
Depends on:
Reported: 2015-08-12 14:09 PDT by Keith Grant
Modified: 2022-06-11 07:29 PDT (History)
5 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Keith Grant 2015-08-12 14:09:47 PDT
Create a relatively-positioned container that has left/right padding. Inside that, create an absolutely-positioned element with left: 0 and right: 0, so its width equals the width of the container. Give the absolutely-positioned element a percentage based left and/or right padding, and that padding will be calculated based on the width of the container's content, rather than the width of the containing block.

I've recreated the bug here: http://codepen.io/keithjgrant/pen/LVvbYZ

The spec states the percentage is calculated with respect to the width of the containing block (http://www.w3.org/TR/css3-box/#the-padding). The containing block should be determined by the padding edge of the ancestor (http://www.w3.org/TR/css3-box/#the-padding).
Comment 1 Ahmad Saleem 2022-06-10 17:36:05 PDT
All browser match each other in the "codepen" test case. Tested using Safari 15.5 on macOS 12.4, Chrome Canary 104 and Firefox Nightly 103. Thanks!

I think this got fixed along the lines and it can be marked as "RESOLVED CONFIGURATION CHANGED". Thanks!