-
Notifications
You must be signed in to change notification settings - Fork 756
Open
Description
From https://drafts.csswg.org/css-position/#abspos-insets
For an absolutely positioned box, the inset properties effectively reduce the containing block into which it is sized and positioned by the specified amounts.
And https://drafts.csswg.org/css-position/#abspos-layout goes on with
- First, its inset-modified containing block is calculated, defining its available space. (See § 3.5 Absolute (and Fixed) Positioning.) [...]
- Next, its width and height are resolved against this definite available space [...]
But that's not actually the case. Percentages are resolved with respect to the original containing block size, not the inset-modified one. E.g.
#cb {
position: relative;
width: 100px;
}
#abspos {
position: absolute;
left: 25px;
right: 25px;
width: 100%;
height: 100px;
background: blue;
}<div id="cb">
<div id="abspos"></div>
</div>results in a 100x100 square, not a 50x100 rectangle. https://software.hixie.ch/utilities/js/live-dom-viewer/saved/8114