Closed Bug 239711 Opened 22 years ago Closed 22 years ago

absolutely positioned div goes over scrollbar if body,html set to height: 100%; overflow: auto;

Categories

(Core :: Layout, defect, P2)

defect

Tracking

()

RESOLVED INVALID

People

(Reporter: junk, Unassigned)

References

()

Details

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040206 Firefox/0.8 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040206 Firefox/0.8 At my test page, http://dackz.net/mozillatests/test1.php, the div #test1 goes over the scrollbar. It's absolutely positioned and has 100% width. body and html are set to 100% height and have overflow: auto;. If overflow: auto; is removed, it does not go over the scrollbar. if height is not set, there is no scrollbar. if height and overflow are set to just body, there is absolutely no problem. Reproducible: Always Steps to Reproduce: 1. Make page with height: 100%; and overflow: auto; set to body and html. 2. Put div on page with position: absolute; and width: 100%; set. 3. Load page. Actual Results: Div goes over scrollbar. Expected Results: Div stops at scrollbar.
Also, the only reason I encountered this was when trying to get a div to have min-height: 100%;. I had to set height: 100%; to body _and_ html, but when I switched the mime type to application/xhtml+xml, it broke my background. The background would only stretch the viewport, and not the entire page, because it was set to body. It didn't scroll with the rest of the page either. Setting the background to html as well as body fixed that, but during that trial and error process, this bug occurred. (Should I file something about the background problems? They're all at http://dackz.net/mozillatests/ ... but I'm relatively new to bugzilla.)
Please retest in a recent build. I checked in a big fix to clipping on 3/10 that should have fixed this.
Present in: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7b) Gecko/20040405
Actually, I think our rendering is correct. Both <HTML> and <BODY> are height:100%, overflow:auto. <HTML> does not overflow the viewport, and <BODY> does not overflow <HTML>, so neither the viewport nor <HTML> need a scrollbar. But the contents of <BODY> do overflow the <BODY>, so the scrollbar you see belongs to <BODY>. Now, the containing block for the absolute DIV is not <BODY>, it is the viewport! So the absolute DIV covers the <BODY> and its scrollbar. Note: the fix for bug 234851 does not change the rendering for this testcase, although the reasoning changes. With the fix for bug 234851, 'overflow:auto' is propagated from <HTML> to the viewport, but <BODY> and <HTML> are still the height of the viewport and the only overflow is where the contents of <BODY> overflow the <BODY>. Marking INVALID on the assumption that my analysis is correct.
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.