Table with position: absolute and align="center" incorrectly creates horizontal scrollbar




Layout: Tables
14 years ago
11 years ago


(Reporter: Joe McCabe, Unassigned)



Bug Flags:
in-testsuite ?

Firefox Tracking Flags

(Not tracked)



(2 attachments)



14 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a3) Gecko/20040803
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a3) Gecko/20040803

When a table is created using the position: absolute; top: 100px style and the
align="center" option a horizontal scrolblar is created with a mostly full thumb
(approx. 1/4" left on the right of the bar).

Test case is:

    <table style="position: absolute; top: 100px" align="center">

The "100px" can be replaced with any value. It has no effect on the scrollbar.

Reproducible: Always
Steps to Reproduce:
*** Bug 254751 has been marked as a duplicate of this bug. ***

Comment 2

14 years ago
Created attachment 155488 [details]
Screen shot showing test case in Mozilla window

Just a screen shot showing the test case in a Mozilla window. Note the
horizontal scroll bar along the bottom of the window.

Comment 3

14 years ago
Note that IE does not center the table in the testcase.

Comment 4

14 years ago
Neither does IE 5 on Mac OS X, Safari, or Konqueror.

Comment 5

14 years ago
Note that the problem can be reproduced after changing the test case a little to
get around the numerous browsers that seem compelled to not center the table:

     <table style="margin-left: auto; margin-right: auto; position: absolute;
top: 100px">

This will still produce a spurious horizontal scroll bar regardless of the
actual size of the Mozilla window.

Comment 6

14 years ago
And removal of 

position: absolute;

makes the scrollbar go away.

Comment 7

14 years ago
Also reproduced with Mozilla on MacOS X. Changing hardware and OS to All.
OS: Linux → All
Hardware: PC → All
Created attachment 161492 [details]

minimal testcase (based on reporter's, minus <hr> and top:100px).


14 years ago
Keywords: testcase
Confirming. Couldn't find a duplicate, despite extensive search.

This is NOT a duplicate of bug 252771 (which is fixed on the trunk; this one isn't).
Also apparently NOT a duplicate of bug 139155 (which requires a <br>).

Also note that either of "margin-left:auto" and "margin-right:auto" in the
testcase can be removed (causing the text to be left- or right-justified, not
centered), and the scrollbar will still be there.
Component: Layout → Layout: Tables
Ever confirmed: true
QA Contact: core.layout → core.layout.tables

Comment 10

12 years ago
As far as I can see, the bug is no longer present. The table is taken out of normal flow and its top and left positions are auto. Margin-left and margin-right are computed as 0px (as reported by DOM inspector) in Seamonkey 1.5a rv:1.9a3 build 2007021310 under XP Pro SP2.

CSS 2.1, Section 10.3
10.3 Calculating widths and margins
"The values of an element's 'margin-left', 'margin-right' properties as used for layout depend on the type of box generated and on each other."

Section 10.3.7
Absolutely positioned, non-replaced elements

"If all three of 'left', 'width', and 'right' are 'auto': First set any 'auto' values for 'margin-left' and 'margin-right' to 0."
which is the case here, in attachment 161492 [details]

Am I wrong? Did I miss something?

Yeah, this got fixed by the reflow branch landing.
Last Resolved: 11 years ago
Depends on: 300030
Resolution: --- → FIXED
Whiteboard: DUPEME


11 years ago
Flags: in-testsuite?
You need to log in before you can comment on or make changes to this bug.