Closed Bug 173746 Opened 22 years ago Closed 22 years ago

css: margin-left and right set to auto. Layer renders outside the browser to the left.


(Core :: Layout, defect)

Not set





(Reporter: erik.melkersson, Assigned: attinasi)




(Keywords: testcase)

I center a div using margin-left and margin-right to auto. The div has a fix
width. When the browser-window has a width less than the width of the div the
div is displayed to the left of the window. (see URL) I can scroll to the right
to see the rest of the page but the stuff on the left is unreachable. I think it
should be left aligned (in my case) when using margin auto (I.e. auto shouldn't
become negative values).

I've tried Mozilla 1.0 and 1.1 (Gecko/20020827)
Do you have a testcase (with CSS in the html file) which you could attach here.
That would be great. I don't know what the specs say about this.
Component: Browser-General → DOM Style
Uh, forgot to reassign to the component owner, sorry for the spam.
Assignee: asa → jst
QA Contact: asa → ian
Arthur, he did provide a testcase (see URL). This is a Layout bug.
Assignee: jst → attinasi
Component: DOM Style → Layout
Ever confirmed: true
Keywords: testcase
OS: SunOS → All
QA Contact: ian → petersen
Hardware: Sun → All
The relevant section of the CSS2.1 specification:

It says nothing about the margin value being nonnegative.  It _does_ say that
the left and right margins should be equal, period.  In fact, negative margin
values are quite allowed.

So the layout here is exactly correct per the spec.  The real bug is the
inability to scroll left; that is covered by a different bug (and I can dig up
the bug# if really needed).
Closed: 22 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.