[csswg-drafts] [css-align] Auto margins aren't just treated as zero (#11230)

Loirooriol has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-align] Auto margins aren't just treated as zero ==
https://drafts.csswg.org/css-align/#justify-abspos

> - For replaced absolutely-positioned boxes, the [normal](https://drafts.csswg.org/css-align/#valdef-justify-self-normal) keyword behaves as [start](https://drafts.csswg.org/css-align/#valdef-self-position-start).
> 
> -  For all other absolutely-positioned boxes, [normal](https://drafts.csswg.org/css-align/#valdef-justify-self-normal) behaves as stretch. Additionally, if neither inset in this axis is [auto](https://drafts.csswg.org/css-position-3/#valdef-top-auto), but [width](https://drafts.csswg.org/css-sizing-3/#propdef-width) ([height](https://drafts.csswg.org/css-sizing-3/#propdef-height), for [vertical writing modes](https://drafts.csswg.org/css-writing-modes-4/#vertical-writing-mode)) is [auto](https://drafts.csswg.org/css-sizing-3/#valdef-width-auto), **auto margins are treated as zero**.
> 
>     (In non-[normal](https://drafts.csswg.org/css-align/#valdef-justify-self-normal) cases, auto margins are prioritized over the [self-alignment properties](https://drafts.csswg.org/css-align/#self-alignment-properties), as usual.)

Treating `auto` margins as zero is not the same as de-prioritizing them, as seen here:

```html
<!DOCTYPE html>
<style>
.wrapper { position: relative; width: 50px; height: 50px; border: 3px solid; }
.abspos { position: absolute; inset: 0; place-self: normal; max-width: 25px; max-height: 25px; background: cyan }
</style>
<div class="wrapper"><div class="abspos" style="margin: auto"></div></div>
<div class="wrapper"><div class="abspos" style="margin: 0px"></div></div>
```

| Spec | Blink<br>Gecko<br>WebKit<br>Servo |
| - | - |
| ![](https://github.com/user-attachments/assets/d184c8b0-e802-4147-91d8-0917b5c47156) | ![](https://github.com/user-attachments/assets/af90c418-ab61-41d1-8488-f56e4f4b45a4) |





Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11230 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 18 November 2024 12:20:02 UTC