Closed Bug 294498 Opened 20 years ago Closed 19 years ago

Height: 100% not calculated properly for body element

Categories

(Core :: Layout, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: viraptor, Unassigned)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.8) Gecko/20050511
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.8) Gecko/20050511

When as w3c states in css2.1 specs I specify height of root element to 100%
(this means 100% of vieport height) and table and body height to 100%, then
mozilla misses body bottom margin when calculating body height.
For example in attached html I set html (height: 100%) it gets height =178px
(from dom inspector).
Body (height: 100%) gets height =170px (margins are default 8px). Table (height:
100%) gets height =168px + 2*1px border.
1'st problem is that there is a vertical scroll - real viewport height is 170px.
2'nd is that only top, left and (probably) right margins are shown - I can
scroll only to bottom border of body.

I think it sould look like this:
No vertical scrolling. From the top of viewport: 8px body top margin, body with
table, 8px body bottom margin. If viewport is 170px high, then html should be
170px high, body 154px high both margins of 8px visible, table 152px high +
2*1px border.

When I set body margins to 0px there was no scrollbars problem.

Reproducible: Always

Steps to Reproduce:




I wrote this after reading this pages:
http://www.w3.org/TR/CSS21/visudet.html#the-height-property ("A percentage
height on the root element is relative to the viewport.")
http://www.w3.org/TR/CSS21/visuren.html#viewport
http://www.w3.org/TR/CSS21/visudet.html#containing-block-details
Correction - right margin suffers the same problem. Just add width: 100% to
table, body and html to see same effect for horizontal scrollbar.
Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.8b2) Gecko/20050516

here, 
<body>  has a margin of 8px
<table> and above has height 376px,
<table> has a border of 1px 
<tbody> and below has height 370px

http://www.w3.org/TR/REC-CSS2/box.html#box-dimensions

looking at the numbers, 6 is 8 minus (1+1), but there should be two 8px margins
minus two 1px borders.
looking at the window, margin is seen left and top, but not bottom.
Scrollbar is available because window doesn´t show body´s top&bottom margins,
upper margin can be seen after scrolling, bottom margin doesn´t exist.
Component: General → Layout
Product: Mozilla Application Suite → Core
Version: unspecified → Trunk
hhschwab@gmail.com: 
Please always select 
"  Reassign bug to owner and QA contact of selected component " if you change
the product/component. Thanks...
Assignee: general → nobody
QA Contact: general → layout
> If viewport is 170px high, then html should be
> 170px high, body 154px high both margins of 8px visible,

Per CSS it should be 170px, not 154px.  So our rendering is exactly correct, and
this bug is invalid.
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → INVALID
Any reason why in case of width & height = 100% bottom and right body margins
are cut off? After rereading w3c I still think all margins should be created and
visible when html is taking full viewport.
> Any reason why in case of width & height = 100% bottom and right body margins
> are cut off?

Yes.  Look up the definition of "height" and "width", please.  Note that they
refer to the content box, not the margin box.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: