[csswg-drafts] [css2][css-position] Static position needs to ignore floats (#9991)

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

== [css2][css-position] Static position needs to ignore floats ==
https://drafts.csswg.org/css2/#abs-non-replaced-width

> The static position for [left](https://drafts.csswg.org/css2/#propdef-left) is the distance from the left edge of the containing block to the left margin edge of a hypothetical box that would have been the first box of the element if its [position](https://drafts.csswg.org/css2/#propdef-position) property had been [static](https://drafts.csswg.org/css2/#valdef-position-static) and [float](https://drafts.csswg.org/css2/#propdef-float) had been [none](https://drafts.csswg.org/css2/#valdef-float-none).

https://drafts.csswg.org/css-position/#staticpos-rect mostly defers to CSS2, but adding `clear: none`:

> Finding the [static position](https://drafts.csswg.org/css-position/#static-position) and the [static-position rectangle](https://drafts.csswg.org/css-position/#static-position-rectangle) assumes that both [float](https://drafts.csswg.org/css2/#propdef-float) and [clear](https://drafts.csswg.org/css2/#propdef-clear) (as well as [position](https://drafts.csswg.org/css-position/#propdef-position)) have their [initial values](https://drafts.csswg.org/css-cascade-5/#initial-value)

But assuming `clear: none` is not enough, this needs to entirely disregard floats, see this testcase:

```html
<!DOCTYPE html>
<div style="overflow: hidden; position: relative; width: 100px; border: solid; margin: 1em 0">
  <div style="float: left; width: 50px; height: 50px; background: magenta"></div>
  <div style="position: absolute; overflow: hidden; width: 25px; height: 25px; background: cyan"></div>
</div>
<div style="overflow: hidden; position: relative; width: 100px; border: solid; margin: 1em 0">
  <div style="float: left; width: 50px; height: 50px; background: magenta"></div>
  <div style="position: static; overflow: hidden; width: 25px; height: 25px; background: cyan"></div>
</div>
```

Gecko, Blink and WebKit agree:

![](https://github.com/w3c/csswg-drafts/assets/7477678/deadbcf0-2eff-4813-8b47-f4be0cf2ee10)




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


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

Received on Friday, 23 February 2024 21:30:48 UTC