This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 15389 - Flawed description of float position when a source-preceding box has a negative vertical margin
Summary: Flawed description of float position when a source-preceding box has a negati...
Status: NEW
Alias: None
Product: CSS
Classification: Unclassified
Component: CSS Level 2 (show other bugs)
Version: unspecified
Hardware: All Windows 3.1
: P2 normal
Target Milestone: ---
Assignee: Bert Bos
QA Contact: public-css-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-02 16:42 UTC by Anton P
Modified: 2012-12-04 00:53 UTC (History)
1 user (show)

See Also:


Attachments

Description Anton P 2012-01-02 16:42:37 UTC
Reported by Anton Prowse, Gérard Talbot

The resolution of Issue 229 (http://wiki.csswg.org/spec/css2.1#issue-229 ; see below) attempted to solve a problem whereby UAs don't obey the the rules for float positioning in certain cases where ource-preceding box has a negative vertical margin.

It did this by appending the following sentence to 9.5.1 after the nine rules for float positioning:

  # But in CSS 2.1, if, within the block formatting context,
  # there is an in-flow negative vertical margin such that
  # the float's position is above the position it would be at
  # were all such negative margins set to zero, the position
  # of the float is undefined. 

This sentence makes undefined cases where we expect float position to be defined.  The position of the float is undefined in the following example:

<p style="margin-top:-1px">Text</p>
<div style="float:left"></div>

Yet it fails to make undefined some of the cases which led this sentence to be introduced in the first place for reasons of lack of consensus on the desired behaviour and of lack of cross-browser interop.  (It's trying to restrict the vertical margins under consideration in order to focus more closely on the specific issues of Issue 229.)  The position of the float is defined in the following example:


but this was one of the cases which is handled differently by different UAs (some allowing the float to overlap earlier line boxes and others not).

This sentence serves no purpose if it fails to make undefined these cases.  It should be fixed to solve Issue 229 (eg when the position of the float is calculated with the specified negative margins then at least Rule 6 needs to be ignored).

Discussion and proposal needed.

Conversation begins: 
http://lists.w3.org/Archives/Public/www-style/2011Mar/0403.html
http://lists.w3.org/Archives/Public/www-style/2011Nov/0157.html

Bug description:
http://lists.w3.org/Archives/Public/www-style/2011Nov/0687.html



Issue 229

Summary
    Floats effect on lines above placeholder
Testcase
    2 basic testcases for issue 229 [http://www.gtalbot.org/BrowserBugsSection/css21testsuite/testcase-for-issue-229.html]
URL
    http://lists.w3.org/Archives/Public/www-style/2010Sep/0149.html http://lists.w3.org/Archives/Public/www-style/2010Oct/0245.html
Proposal
    Add, “If, within the BFC, there is an in-flow negative vertical margin such that the floats position is above the position it would be at were all such negative margins set to zero, the position of the float is undefined.”
Resolution
    Proposal accepted
Status
    Closed.
Comment 1 Anton P 2012-01-02 16:51:31 UTC
I forgot to include the example of where the float position is defined for a case that was intended to be undefined:

<p>text</p>
<div style="margin-top:-10px">
    <div style="float:left"></div>
</div>
Comment 2 Anton P 2012-02-04 13:21:51 UTC
(Note that Bug 15881 discusses an alternative approach to solving Issue 229 that makes fewer easy cases undefined.)