Closed
Bug 278170
Opened 21 years ago
Closed 21 years ago
Scrollbars appear despite no content overflowing (with top margin set)
Categories
(Core :: Layout, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: Biesinger, Unassigned)
Details
Attachments
(1 file)
|
264 bytes,
text/html
|
Details |
The testcase I'm about to attach shows that scrollbars unnecessarily appear when
a top margin is set on a first <div> in a document.
Notes:
- html and body must have height:100%
- body may or may not have a margin
- removing the margin-top makes the scrollbars disappear.
Expected results:
- No scrollbar when there is no invisible content
| Reporter | ||
Comment 1•21 years ago
|
||
Comment 2•21 years ago
|
||
Isn't this a matter of the top margin of the div collapsing with the body margin
and thus overflowing the viewport off the top? Though I'm surprised at the area
that we end up being able to scroll to a bit...
Comment 3•21 years ago
|
||
Replacing the 5px top margin with a 5px white border made the scrollbar go away.
| Reporter | ||
Updated•21 years ago
|
Summary: Scrollbars appear despite no content overflowing (with top and bottom margins set) → Scrollbars appear despite no content overflowing (with top margin set)
| Reporter | ||
Comment 4•21 years ago
|
||
urg. I guess. so the margin ends up being applied to the body, instead of the div?
I guess I'll just use overflow:hidden; on the html and the body...
OS: Linux → All
| Reporter | ||
Comment 5•21 years ago
|
||
also, if the viewport is overflowed at the top, then why can I scroll down
instead of up?
Comment 6•21 years ago
|
||
So how do you stop the margin collapsing?
Comment 7•21 years ago
|
||
Yes, the margin gets applied to the body. Yes, the scroll direction is odd.
See comment 2 sentence 2. ;)
Neil: You prevent collapse by putting something between the margins (border or
padding on the parent, or content in the parent before the child) or by making
the child or parent have overflow or be a float, or be absolutely positioned.
So actually, maybe just putting position:absolute on the body (and
position:relative on the <html>, maybe?) might help.
| Reporter | ||
Comment 8•21 years ago
|
||
well, marking invalid I guess. we fixed it by using height:99% instead of 100%,
but we'll probably try the position:absolute; idea...
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → INVALID
| Reporter | ||
Comment 9•21 years ago
|
||
7 body { position:absolute; }
8 html { position:relative; }
this doesn't seem to help, though...
You need to log in
before you can comment on or make changes to this bug.
Description
•