-
Notifications
You must be signed in to change notification settings - Fork 756
Open
Description
CSS 2.1 and CSS Position say
- 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
- 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 ChromeWhat is the expected behavior?