[csswg-drafts] [CSS2] BFCs calculate auto margins from containing block minus floats

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

== [CSS2] BFCs calculate auto margins from containing block minus floats ==
CSS2.1 specifies that `auto` margins divide the space from “containing block width - size of margin box treating auto as zero”. However, for BFCs, implementations seem to calculate it from “containing block width - impeding floats - size of margin box treating auto as zero”. Implementations are consistent across everything tested in https://developer.microsoft.com/en-us/microsoft-edge/tools/screenshots/

(The effect is that, in implementations, a margin-centered BFC is centered in the remaining space not impinged on by the float; per 2.1, it should be centered in the full containing block width then shifted just enough to avoid overlapping the float.)

Testcase: http://software.hixie.ch/utilities/js/live-dom-viewer/?saved=5281
Spec: https://www.w3.org/TR/CSS2/visudet.html#blockwidth

Note: This behavior is what we agreed to for BFCs in https://github.com/w3c/csswg-drafts/issues/1612, partially *because* margins were specified to have the different behavior, and both possible behaviors had their uses.  If we fix the spec to match implementations, we'll lose the possibility of this "shift just enough" behavior, and might want to add it back explicitly to Align somehow.

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

Received on Tuesday, 3 April 2018 23:23:06 UTC