Rounding error positioning float: right inside block with percentage margins




Layout: Floats
16 years ago
8 years ago


(Reporter: Daniel Steinberger, Unassigned)




Firefox Tracking Flags

(Not tracked)


(Whiteboard: [CSS1-5.5.5][CSS1-5.5.25], URL)


(2 attachments, 1 obsolete attachment)



16 years ago
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

16 years ago
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.


16 years ago
QA Contact: petersen → moied

Comment 2

16 years ago
Confirmed with build ID 20020214 on win2k
Ever confirmed: true
Priority: -- → P4


16 years ago
Target Milestone: --- → Future


16 years ago
Blocks: 134942

Comment 3

15 years ago
Assignee: attinasi → float
Component: Layout → Layout: Floats
Priority: P4 → --
QA Contact: moied → ian
Target Milestone: Future → ---


14 years ago
Priority: -- → P3
Target Milestone: --- → Future

Comment 4

14 years ago
I dont see any odd thing with the testcase, is this WFM? Build 20040114, Windows XP.

Comment 5

14 years ago
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.
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.
Attachment #69511 - Attachment is obsolete: true
Keywords: css1
Summary: rounding error (?) with right floating DIVs and negative margins → Rounding error positioning float: right inside block with percentage margins
Whiteboard: [CSS1-5.5.5][CSS1-5.5.25]

Comment 7

14 years ago
*** Bug 214567 has been marked as a duplicate of this bug. ***

Comment 8

14 years ago
I'm seeing this on Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:)

It's definitely still a bug.


14 years ago
OS: Windows XP → All
Hardware: PC → All

Comment 9

14 years ago

Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7b) Gecko/20040331
Microsoft Windows 2000 Professional 5.00.2195 SP4
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...
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

10 years ago
Hmm, this looks like a rounding error in the computed values; not sure if we care enough to do double-precision math, though.
Assignee: layout.floats → nobody
QA Contact: ian → layout.floats
You need to log in before you can comment on or make changes to this bug.