Closed Bug 220243 Opened 17 years ago Closed 17 years ago

CSS, auto margins, and scrolling: inconsistent behavior with and without border (margin: auto centering with overflow)

Categories

(Core :: Layout: Block and Inline, defect, P1)

x86
All
defect

Tracking

()

RESOLVED DUPLICATE of bug 185411

People

(Reporter: ods94043, Unassigned)

Details

(Keywords: helpwanted, testcase)

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20030917
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20030917

This appears to be related to 173746. Consider two fixed-width DIV elements
whose margins are set to 'auto' on the left and right. Let one of the DIVs
specify a border. Then, as the window rezizes so that a scrollbar becomes
necessary to view the content, there appears to be an inconsistency as to how
the auto margins are handled, depending on whether a border exists around the
box or not.

Note that 173746 was marked invalid because it was determined that it was not a
layout but, but rather an already reported 'scrollbar' bug (which one?). Yet
this inconsistency suggests that there is still a bit of work to do on the
layout end.

Have not yet checked how other browsers do this, but I don't hold out any hope
that they do any better. :-)


Reproducible: Always

Steps to Reproduce:
1. Go to the specified URL. Two DIV elements are at a fixed width of 800px.
2. Verify that the two paragraphs are centered horizontally in the window.
3. Resize the window to less than 800px.

Actual Results:  
The scrollbar thumb stays to the far right. But the top DIV gets clipped on the
left hand side (as bug 173746 reports); because the scrollbar is all the way
over to the left, the clipped content is unreachable. The bottom DIV is
'shifted' to the right such that its left border aligns with the left of the
viewport; thus, all of its content is viewable.

Expected Results:  
The two DIVs should be handled the same way. The handling of the unbordered DIV
is technically correct (auto margin should translate into a negative left margin
when the window is shorter in width than the DIV), but in this case I think the
scrollbar thumb should be set to center, and the scrollbar range set so that all
of the content is reachable. But I think the way the bordered DIV is handled
suggests an alternative interpretation that might also be to CSS spec and would
IMO be more convenient for the user: when there are negative margins, Mozilla
automatically scrolls the viewport over to the furthest left of these margins 
(i.e. to the left side of the MBB around all the page's blocks).
Have attached the test case. Please disregard the URL and use the attachment
instead.
Status: UNCONFIRMED → NEW
Ever confirmed: true
I'm pretty sure I've seen this behavior reported before.  There's probably
already a bug report that covers this that this bug dup's too....

OS->All, see this in Win2K
Keywords: helpwanted, testcase
OS: Linux → All
Whiteboard: DUPEME
*** Bug 224470 has been marked as a duplicate of this bug. ***

*** This bug has been marked as a duplicate of 6976 ***
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → DUPLICATE
no, this should stay open, since it definitely demonstrates inconsistent behavior.
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
Yes, I see the problem in the testcase too.  This has been reported numerous
times before (e.g. bug 191626 which has almost an identical testcase), many of
them ended up as duplicates of bug 6976.  Is there something new here that I
missed?
We shouldn't behave differently depending on whether there's a border.
(And I've actually proposed to the CSS working group that the behavior we have
with the border become correct.  It's more consistent with what other browsers
do and leads to less surprising results when the window is narrowed more than
the author expected it to be.)
Summary: CSS, auto margins, and scrolling: inconsistent behavior with and without border → CSS, auto margins, and scrolling: inconsistent behavior with and without border (margin: auto centering with overflow)

*** This bug has been marked as a duplicate of 185411 ***
Status: REOPENED → RESOLVED
Closed: 17 years ago17 years ago
Resolution: --- → DUPLICATE
Whiteboard: DUPEME
You need to log in before you can comment on or make changes to this bug.