width:auto div with overflow:auto gets horizontal scrollbar




Layout: R & A Pos
17 years ago
14 years ago


(Reporter: Philip Pawley, Unassigned)



Firefox Tracking Flags

(Not tracked)





17 years ago
In the test case given above, I have a fixed-positioned menu with

When the vertical scrollbar appears, it robs some of the width required by the
menu. This makes the space for the menu too narrow and forces a horizontal
scrollbar to appear also. 

This can be reproduced by re-sizing the browser window on the above url.
I got this both with Mozilla 0.8.1 and with the latest build: 2001060804.

Comment 1

17 years ago
I always see the scrollbars on linux, build 2001060809, even if I enlarge the
browser window to full screen size. Netscape 4.77 has a very funky rendering of
the page.

The URL is wrong. You probably meant


Comment 2

17 years ago
Thanks, Diego, for pointing out the mistake: I left the original http:// in when I pasted the url.

It sounds like the additional problem with Linux is another, separate bug? (That's assuming you're not using a large font so that the menu still overflows even with a maximised window). 

Comment 3

17 years ago
Changing component
Component: Layout → Style System

Comment 4

17 years ago
Qa contact too.
Assignee: karnaze → pierre
QA Contact: petersen → ian
So what's the bug here? Is it that the scrollbar makes the content area of the
menu smaller?

The CSS spec does not say where the scrollbar should be placed.  Placing it
outside the positioned element's content area would make just as little sense...

That said, you should size the box larger. On linux it's always a little too
narrow for the contained text, not matter what font size I use -- it scales with
the font.

Comment 6

17 years ago
Boris, the box is sized with "width:auto" so as to be exactly the size it needs to be for the text it contains (regardless of font-size). The scrollbar breaks that by automatically making the box just that little bit too narrow.

Are you saying that, with Linux, the box is too narrow *even without the scrollbar*? If so, that is yet another bug.
The bug would be that on Linux the div always seems to think that it can scroll
up and down.  so it always gets a vertical scrollbar and thus always a
horizontal one.

But the original bug seems valid... we should be a little more clever about
sizing width:auto things, it seems.

Giving this a clearer summary.
Ever confirmed: true
OS: Windows 98 → All
Hardware: PC → All
Summary: Scrollbar misplaced with position:fixed and overflow:auto → width:auto div with overflow:auto gets horizontal scrollbar

Comment 8

17 years ago
Reassigned to evaughan like other bugs with overflow:auto in absolutely 
positioned elements (bug 34031 and bug 44298).
Assignee: pierre → evaughan

Comment 9

16 years ago
Target Milestone: --- → mozilla1.1

Comment 10

15 years ago
Bug is still there with Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4b)
Assignee: eric → position
Component: Style System → Layout: R & A Pos
Target Milestone: mozilla1.1alpha → ---

Comment 12

14 years ago
(In reply to comment #0)

I got a similar problem,

On my website gokkast.dnsalias.net I got a gambling machine in javascript.
My site opens the game with a open() command with precies height and width.
If you open the game in 800x600 or less (unintended) scrollbars will apear and
it will shift the <DIV> element with a <IMG> to the right. 
In so doing misplacing the image over the other images, IE doesn't have any
problems if scrollbars apear.
WFM, 2004-08-24-05 trunk Linux.

Philip, do you see any remaining problem?

Comment 14

14 years ago
That looks very good, Mats.

Last Resolved: 14 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.