[css-position-3] Auto margin resolution isn't symmetrical. · Issue #5374 · w3c/csswg-drafts (original) (raw)

https://drafts.csswg.org/css-position-3/#abspos-margins

Otherwise, the remaining space is calculated as the size of its inset-modified containing block in the relevant axis minus the box’s used size in the relevant axis, and this remaining space is divided among any auto margins in the relevant axis. However, if the remaining space is negative and both margins are auto, the start margin resolves to zero and the end margin receives the remaining space.

There is a sutle different between the horizontal and vertical (or inline, and block? - needs research) algorithms:
https://drafts.csswg.org/css-position-3/#abs-non-replaced-width
https://drafts.csswg.org/css-position-3/#abs-non-replaced-height

See this testcase:
https://www.software.hixie.ch/utilities/js/live-dom-viewer/?saved=8318

In the vertical (or block, but which block?) direction negative auto margins get distributed evenly between the top and bottom, where-as horizontal (or inline) the inline-start margin is zero.