Last Comment Bug 125560 - Rounding error positioning float: right inside block with percentage margins
: Rounding error positioning float: right inside block with percentage margins
Status: NEW
: css1
Product: Core
Classification: Components
Component: Layout: Floats (show other bugs)
: Trunk
: All All
P3 normal with 4 votes (vote)
: Future
Assigned To: Nobody; OK to take it and work on it
: Jet Villegas (:jet)
: 214567 (view as bug list)
Depends on:
Blocks: 134942
  Show dependency treegraph
Reported: 2002-02-14 12:14 PST by Daniel Steinberger
Modified: 2009-08-26 14:26 PDT (History)
8 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

the mentioned testcase (2.59 KB, text/html)
2002-02-14 12:18 PST, Daniel Steinberger
no flags Details
Somewhat reduced testcase showing problem (3.17 KB, text/html)
2004-03-03 18:29 PST, Christopher Hoess (gone)
no flags Details
Compound percentages rounding error test case (623 bytes, text/html)
2004-07-18 08:20 PDT, Greg K Nicholson [:gkn]
no flags Details

Description User image Daniel Steinberger 2002-02-14 12:14:15 PST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:0.9.8+)
BuildID:    2002021203

due to rounding errors, Mozilla (and thus Netscape 6.x) may not move a
right-floated element over as far as it should be - this way the overlapping
margins display wrong.

Reproducible: Always
Steps to Reproduce:
1. visit URL or open testcase
(2. if you're at the URL, go down to the punchbox "better stick to what's needed")
3. resize your window a little, until you can see a border at the right of the

Actual Results:  sometimes (rounding?) there is a border

Expected Results:  border should never appear

Opera6 does it perfectly right (at least my testcase)
IE6 does.. strange things. it doesn't change the display, but it doesn't display
it perfectly either
Mozilla does it well, except when your window is at a bad size
Comment 1 User image Daniel Steinberger 2002-02-14 12:18:00 PST
Created attachment 69511 [details]
the mentioned testcase

this is a simplyfied testcase demonstrating the issue. you may find the same
testcase here: -
it's a stipped down example of Eric A. Meyer's punchbox demo. easy to read.
Comment 2 User image Moied 2002-02-15 15:02:17 PST
Confirmed with build ID 20020214 on win2k
Comment 3 User image Boris Zbarsky [:bz] (still a bit busy) 2003-04-24 21:59:29 PDT
Comment 4 User image José Jeria 2004-01-16 11:39:38 PST
I dont see any odd thing with the testcase, is this WFM? Build 20040114, Windows XP.
Comment 5 User image Daniel Steinberger 2004-01-16 16:34:11 PST
it's still there in mozilla-1.6 (id 20040113) - so it probably will be for your
build. did you RESIZE you window pixelwise? the bug only appears sometimes, when
the window-width triggers this rounding error.
Comment 6 User image Christopher Hoess (gone) 2004-03-03 18:29:53 PST
Created attachment 142882 [details]
Somewhat reduced testcase showing problem

I've attached a somewhat reduced testcase. To see the bug, it is essential that
the containing block of the float: right have a percentage margin. Furthermore,
the analogous testcase with float: left (included) shows no rounding errors at
any window width, regardless of resizing from right or left.
Comment 7 User image Vardyr 2004-03-11 09:14:22 PST
*** Bug 214567 has been marked as a duplicate of this bug. ***
Comment 8 User image Vardyr 2004-03-11 09:17:26 PST
I'm seeing this on Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:)

It's definitely still a bug.
Comment 9 User image Anders Pedersen 2004-03-31 20:13:34 PST

Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7b) Gecko/20040331
Microsoft Windows 2000 Professional 5.00.2195 SP4
Comment 10 User image Greg K Nicholson [:gkn] 2004-07-18 08:14:20 PDT
A similar thing happens when a div with a percent-based width contains two other
divs, one floated left, one right, whose widths add up to 100%. It seems to be
the same issue. Testcase follows...
Comment 11 User image Greg K Nicholson [:gkn] 2004-07-18 08:20:02 PDT
Created attachment 153585 [details]
Compound percentages rounding error test case

The divs are coloured for clarity.
This doesn't seem to reproduce using ems in the outer div, nor in both the
outer and inner divs, resizing window, text or both.
Removing the percentage width from the outer div, or assigning a width of 100%
seems to fix the bug.
Any percentage width other than 100% seems to reproduce the bug.
Comment 12 User image Eli Friedman 2007-06-26 18:05:23 PDT
Hmm, this looks like a rounding error in the computed values; not sure if we care enough to do double-precision math, though.

Note You need to log in before you can comment on or make changes to this bug.