W3C home > Mailing lists > Public > public-css-archive@w3.org > May 2017

[csswg-drafts] [css-display][css-position] Computed value of float with absolute positioning when there is no box?

From: Loirooriol via GitHub <sysbot+gh@w3.org>
Date: Sun, 21 May 2017 15:58:42 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-230230008-1495382320-sysbot+gh@w3.org>
Loirooriol has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-display][css-position] Computed value of float with absolute positioning when there is no box? ==
[CSS 2.1](https://www.w3.org/TR/CSS21/visuren.html#dis-pos-flo) and [CSS Position](https://drafts.csswg.org/css-position/#dis-pos-flo) say

> 1. If 'display' has the value 'none', then 'position' and 'float' do not apply. In this case, the element generates no box.

But does this affect the computed value of `position` or `float`?

Both Firefox and Chrome seem to think that the computed value should be the specified one. However, if you specify both absolute positioning and floating, Edge computes `float` to `none`, according to

> 2. Otherwise, if 'position' has the value 'absolute' or 'fixed', the box is absolutely positioned, the computed value of 'float' is 'none'

Anyways, the interesting case is `display: contents`, which didn't exist in CSS 2.1. I guess it should interact with `position` and `float` just like `display: none` does.

However, in this case Firefox and Chrome also compute `float` to `none` when an element with `display: contents` has both both absolute positioning and floating.

<div id="test1" style="position: absolute; float: left; display: none"></div>
<div id="test2" style="position: absolute; float: left; display: contents"></div>
getComputedStyle(test1).float; // "left" on Firefox and Chrome, "none" on Edge
getComputedStyle(test2).float; // "none" on Firefox and Chrome

What is the expected behavior?

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1436 using your GitHub account
Received on Sunday, 21 May 2017 15:58:48 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:13 UTC