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

RESOLVED FIXED

Status

()

Core
Layout: Tables
RESOLVED FIXED
14 years ago
11 years ago

People

(Reporter: Joe McCabe, Unassigned)

Tracking

({testcase})

Trunk
testcase
Points:
---
Bug Flags:
in-testsuite ?

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

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:

<html>
  <body>
    <table style="position: absolute; top: 100px" align="center">
	<tr>
	  <td>
	    <hr>
	    foobar
	  </td>
	</tr>
    </table>
  </body>
</html>

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. ***
(Reporter)

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.
(Reporter)

Comment 4

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

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.
(Reporter)

Comment 6

14 years ago
And removal of 

position: absolute;

makes the scrollbar go away.
(Reporter)

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]
testcase

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

Updated

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.
Status: UNCONFIRMED → NEW
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."
http://www.w3.org/TR/2006/WD-CSS21-20061106/visudet.html#Computing_widths_and_margins

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."
http://www.w3.org/TR/2006/WD-CSS21-20061106/visudet.html#abs-non-replaced-width
which is the case here, in attachment 161492 [details]

Am I wrong? Did I miss something?

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

Updated

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