Closed
Bug 176706
Opened 22 years ago
Closed 7 years ago
1px rounding error when displaying margins (in %) of block elements in cells
Categories
(Core :: Layout, defect, P4)
Tracking
()
RESOLVED
FIXED
Future
People
(Reporter: pascalc, Unassigned)
References
(Blocks 1 open bug)
Details
(Keywords: testcase)
Attachments
(1 file)
(deleted),
text/html
|
Details |
Mozilla 2002102208 WinXP
1 create a 700px wide table with 3 rows and 1 cell per row
2 insert a 420px wide paragraph in each row
3
- the first paragraph has left and right margins set to 20%
- the second paragraph has margins set to auto
- the third paragraph has left and right margins set to 140px
table, tr, td and p margins and paddings are set to 0
expected result : the three paragraph should be identically centered
actual result : the first paragraph is offset 1px to the right, if you increase
text size (130% with a default font set to 18px Arial), the box gets correctly
centered which makes me think of a rounding problem
I will attach a testcase
Reporter | ||
Comment 1•22 years ago
|
||
Reporter | ||
Comment 2•22 years ago
|
||
update to the bug report, this problem seems to happen only when the sidebar is
open. With the sidebar closed, it is the reverse problem, the box is correctly
centered and the 1px offset problem appears wheb you increase text size.
Updated•22 years ago
|
QA Contact: gerardok → amar
Updated•22 years ago
|
Priority: -- → P4
Target Milestone: --- → Future
Reporter | ||
Comment 3•22 years ago
|
||
adding testcase keyword. Still seeing the problem with build 2003042208
Keywords: testcase
Comment 4•20 years ago
|
||
This might not be a bug.
The problem is that if none of margin, border, padding, content (<p>) and
container (<table>) has auto-width, it may be impossible to make this equation
work:
'margin-left' + 'border-left-width' + 'padding-left' + 'width' +
'padding-right' + 'border-right-width' + 'margin-right'
= width of containing block
(the values are "over-constrained", see CSS 2.1 Specification: 10.3.3)
If you insert the values from the first paragraph of the testcase, you get:
20% * tableWidth + 1px + 0px + 420px + 0px + 1px + 20% * tableWidth = tableWidth
You can't have all of that (20% margin, 1px border, 0 padding, 420px width) with
a 700px table, because 702px != 700px.
Mozilla then increases the width of the table element to make room for all that
stuff. If you increase the width of the first paragraph's border to, you can see
more clearly what happens.
Updated•15 years ago
|
Assignee: layout → nobody
QA Contact: amar → layout
Reporter | ||
Comment 5•7 years ago
|
||
This was fixed since I filed this bug 15 years ago :) None of the Firefox versions we currently ship has this bug.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•